Twitch Clip Downloader

adds a download link to twitch clips

目前为 2021-01-13 提交的版本。查看 最新版本

// ==UserScript==
// @name         Twitch Clip Downloader
// @namespace    cdl
// @version      0.1
// @description  adds a download link to twitch clips
// @author       cc114
// @match        http*://clips.twitch.tv/*
// @exclude      http*://clips.twitch.tv/create
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var link;
    var fail = 0;
    function geturl() {
        link = document.querySelector(".video-player__container > video:nth-child(1)").getAttribute("src");
        if (link == null || link == undefined) {
            console.log('[CDL] waiting');
            if (fail < 5) {
                setTimeout(geturl, 500);
            }
        } else {
            console.log('[CDL] found clip link');
            console.log('[CDL] ' + link);
            var div = document.createElement ('div');
            div.innerHTML = '<a href="' + link + '">Download</a>';
            var main = document.querySelector(".clips-watch > div:nth-child(1)");
            main.insertBefore(div, document.querySelector("div.tw-pd-t-1:nth-child(3)"));
        }
    }
    window.addEventListener('load', () => {
        geturl();
    });
})();

QingJ © 2025

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