Created
February 7, 2020 18:20
-
-
Save olafurw/fd0eae3971593900e32dde2ab65ed59a to your computer and use it in GitHub Desktop.
Tampermonkey thing that will remove old recommended videos from youtube frontpage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name YouTube Recommended Remove Old Videos | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Removes old videos from YouTube's recommended page | |
// @author @OlafurW | |
// @include https://www.youtube.com/* | |
// @grant none | |
// @require https://code.jquery.com/jquery-3.4.1.min.js | |
// ==/UserScript== | |
const old = [ 'years ago', '1 year ago', '12 months ago', '11 months ago', '10 months ago', '9 months ago', '8 months ago', '7 months ago' ]; | |
const refreshRateMs = 1000; | |
function Remove() | |
{ | |
// done because of shadowing issues in the include/exclude system of tampermonkey | |
// I don't want this to run on any sub page of youtube | |
if (window.location.href === "https://www.youtube.com/") | |
{ | |
for (const age of old) | |
{ | |
// sorry, the whole parent parent thing is ugly | |
// if you have a nicer solution, please do that | |
$(`span.ytd-video-meta-block:contains(${age})`).parent().parent().parent().parent().parent().parent().parent().parent().parent().remove(); | |
} | |
} | |
setTimeout(Remove, refreshRateMs); | |
} | |
(function() { | |
'use strict'; | |
Remove(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment