Luke's VidDownloader

Allows you to download videos from reddit easily!

目前为 2019-08-15 提交的版本。查看 最新版本

// ==UserScript==
// @name         Luke's VidDownloader
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  Allows you to download videos from reddit easily!
// @author       You
// @match        https://www.reddit.com/r/*
// @match        https://www.youtube.com/*
// @grant        none
// @run-at       document-idle
// ==/UserScript==

(function() {
    'use strict'
    // Behave differently on different sites.
    const loc = window.location.href;
    if(loc.startsWith('https://www.reddit.com/r/')) {
        window.setInterval(function(){
            try {
                const a = document.getElementById('downloadfromplugin').id;
            } catch(e) {
                try {
                    const videolink = window.location.href;
                    const buttonZone = document.getElementsByClassName('PWY92ySDjTYrTAiutq4ty')[0];
                    buttonZone.innerHTML += `<button id="downloadfromplugin" class="_2snJGyyGyyH38duHobOUKE m9hgq8-2 dAQykt b1zwxr-0 hxpTao" role="menuitem"><span class="m9hgq8-0 inRMrM"><i class="icon icon-embed _3MSdPVJwGxrpakz-e1MQhO s1htoir6-0 bpvrMF"></i></span><span class="m9hgq8-1 dRGkl">Download</span></button>`;
                    const added = document.getElementById('downloadfromplugin');

                    added.addEventListener('click', function () {
                        window.location.href = "https://ripsave.com/download?video=" + videolink;
                    });
                } catch(error) {}
            }
        }, 200);
    }
    if(loc.toLowerCase().includes('youtube.com/watch?v=')) {
        try {
            const viewCount = document.getElementsByClassName('view-count')[0];
            const link = loc.replace('youtube', 'youtubepp'); // This is the alias to access the site.
            viewCount.innerHtml += ' <a href="' + link + '">(Download This Video)</a>';
        } catch(e) {
            // Seems like a reasonable time to assume the viewcount has rendered.
            setTimeout(enableYoutubeLink, 3000);
        }
    }
})();
function enableYoutubeLink() {
    const loc = window.location.href;
    const viewCount = document.getElementsByClassName('yt-view-count-renderer')[0];
    const link = loc.replace('youtube', 'youtubepp'); // This is the alias to access the site.
    viewCount.innerHTML = viewCount.innerHTML + ' <a href="' + link + '">(Download This Video)</a>';
    console.log('done it');
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址