Greasy Fork is available in English.

Clean Twitter Feed

Remove "promoted" posts

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

You will need to install an extension such as Tampermonkey to install this script.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Clean Twitter Feed
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Remove "promoted" posts
// @author       Sylvain Galibert
// @match       *://twitter.com/*
// @match       *://*.twitter.com/*
// @license MIT 
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Every second, check if there is an article (each post on Twitter is in an article element) which contains the text "Promoted" and hides it.
    // This gets rid of all the fake posts.
    // The interval is needed because Twitter constantly load new articles.
    var i = setInterval(function(){
            const articles = document.querySelectorAll("article");
            for (const article of articles){
                const articleContent = article.innerHTML;
                // This works fine, but it's brittle - TODO: identify better the "Promoted" posts to avoid catching posts which merely contain the word "Promoted".
                // note: search takes a regex expression and is case sensitive by default.
                if (articleContent.search("Promoted") !== -1){
                    article.style.display = "none";
                }
            }

    }, 1000);

})();