YoutubePopularUserPage

Redirects to Most Popular Videos

当前为 2017-10-12 提交的版本,查看 最新版本

// ==UserScript==
// @name         YoutubePopularUserPage
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Redirects to Most Popular Videos
// @author       ceberous
// @match        https://www.youtube.com/user/*/videos*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var ending = "view=0&sort=p&flow=grid";
    var url = window.location.href;
    var ytUserPagePattern = /^https:\/\/www.youtube.com\/user\/([^\/]+)\/videos/;
    if ( ytUserPagePattern.test( url ) ) {
        var wNU = url.split("videos?");
        if ( wNU[1] !== ending ) {
            wNU = wNU[0] + "videos?" + ending;
            window.location.replace( wNU );
        }
    }
})();