Skip to content

Instantly share code, notes, and snippets.

@moyashi
Last active January 9, 2019 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moyashi/a1c38ad80caf4165ed0c282a8b69649e to your computer and use it in GitHub Desktop.
Save moyashi/a1c38ad80caf4165ed0c282a8b69649e to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name XRPSearchFilter
// @namespace http://hitoriblog.com/
// @version 0.1
// @description try to take over the world!
// @author moyashi
// @match https://twitter.com/search*
// @require https://code.jquery.com/jquery-3.3.1.slim.min.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
var blockList = ["@hiko77777771", "@scirocc465", "@cointrend_jp", "@followme_speed", "@matome_matome", "@wadai_kaso", "@coin_chart", "@coinutils", "@Kasou__Tuka", "@coinbot4"];
var blockURLList = ["bit.ly", "goo.gl", "www.binance.com/?ref"];
var ngWords = ["LINE", "プレゼント", "プレゼント", "毎日もらえる", "寝てるだけで", "MUFJ銀行にあなたが", "1万リップル", "ゼニー リップル", "一緒に学びませんか", "詳しく知りたい方", "#ネットビジネス", "応募", "ほったらかし", "完全自動", "完全無料", "無料で", "無料で貰える", "現金1万円もらえます", "#バイナリー", "#アパート経営", "【速報】", "【朗報】", "【悲報】", "ご登録", "資産を大きく増やせる", "ノアコイン"];
function filterThemOut() {
var tweets = $(".stream-item");
if (tweets.length > 0) {
tweets.each(function (index, element) {
var username = $(element).find(".username:first").text();
var link = $(element).find("a.twitter-timeline-link").attr('data-expanded-url');
var tweetText = $(element).find(".tweet-text").text();
if (blockList.includes(username)) {
element.remove();
return true; // continue;
}
if( typeof link !== 'undefined') {
$.each(blockURLList, function (index, url) {
if (link.includes(url)) {
element.remove();
return true; // continue;
}
});
}
$.each(ngWords, function (index, word) {
if (tweetText.includes(word)) {
element.remove();
return true; // continue;
}
});
});
}
}
$(document).ready(function(){
setTimeout(function(){
filterThemOut();
},1000);
});
$(document).bind('DOMNodeInserted', function (e) {
var element = e.target;
if (element.nodeName == "LI") {
filterThemOut();
}
});
})();
@moyashi
Copy link
Author

moyashi commented Jan 9, 2019

https://tampermonkey.net で使っているTwitterの検索フィルターです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment