Twitter 网页版多视频/gif下载.[limbopro]

Twitter 网页版视频/gif下载(GIF/单/多视频解析及下载)

目前為 2024-05-07 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Twitter 网页版多视频/gif下载.[limbopro]
// @namespace    https://limbopro.com/
// @version      0.1.3.6
// @description  Twitter 网页版视频/gif下载(GIF/单/多视频解析及下载)
// @author       limbopro
// @license MIT
// @match        https://twitter.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant        none
// ==/UserScript==



(function () {
    'use strict';
    setInterval(() => {
        if (document.querySelectorAll('[data-testid="cellInnerDiv"]')) {
            var article = document.querySelectorAll('[data-testid="cellInnerDiv"]')

            
            for (let i = 0; i < article.length; i++) {
                if (!article[i].querySelector('a[href*=greasyfork]')) {
                    if (article[i].querySelector('[data-testid="videoPlayer"]')) {
                        console.log(article[i].textContent);
                        let a = document.createElement('a')
                        a.href = 'https://greasyfork.org/zh-CN/scripts/478651-twitter-%E7%BD%91%E9%A1%B5%E7%89%88%E5%A4%9A%E8%A7%86%E9%A2%91%E4%B8%8B%E8%BD%BD-limbopro';
                        a.className = 'greasyfork'
                        a.target = '_blank';
                        a.zIndex = '114154';
                        a.style = 'position:absolute;right:295px;top:5px;background:linear-gradient(rgb(62 53 53) 0%, rgb(31 29 29) 100%);text-transform:uppercase;padding:6px 12px;box-shadow:rgb(0 0 0) 0px 2px 2px inset;color:white;z-index:114154;padding-right:15px;'
                        a.textContent = "如何下载?";
                        if (article[i].querySelectorAll("div[class='css-175oi2r r-1p0dtai r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-1loqt21']")[0]) {
                            article[i].querySelectorAll("div[class='css-175oi2r r-1p0dtai r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-1loqt21']")[0].appendChild(a);
                        } else {
                            article[i].appendChild(a);
                        }
                    }
                }
            }

    

            for (let i = 0; i < article.length; i++) {
                if (!article[i].querySelector('a[href*=twittervid]')) {
                    if (article[i].querySelector('[data-testid="videoPlayer"]')) {
                        console.log(article[i].textContent);
                        let a = document.createElement('a')
                        a.href = 'https://twittervid.com/';
                        a.className = 'twittervid'
                        a.target = '_blank';
                        a.zIndex = '114154';
                        a.style = 'position:absolute;right:173px;top:5px;background:linear-gradient(to bottom, #66BB6A 0%, #43A047 100%);text-transform:uppercase;padding:6px 12px;box-shadow:inset 0 2px 2px #388E3C;color:white;z-index:114154;padding-right:15px;'
                        a.textContent = "下载视频[vid]";
                        if (article[i].querySelectorAll("div[class='css-175oi2r r-1p0dtai r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-1loqt21']")[0]) {
                            article[i].querySelectorAll("div[class='css-175oi2r r-1p0dtai r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-1loqt21']")[0].appendChild(a);
                        } else {
                            article[i].appendChild(a);
                        }
                    }
                }
            }



            for (let i = 0; i < article.length; i++) {
                if (!article[i].querySelector('a[href*=twittervideodownloader]')) {
                    if (article[i].querySelector('[data-testid="videoPlayer"]')) {
                        console.log(article[i].textContent);
                        let a = document.createElement('a')
                        a.href = 'https://twittervideodownloader.com/';
                        a.className = 'twittervideodownloader'
                        a.target = '_blank';
                        a.zIndex = '114155';
                        a.style = 'position:absolute;right:15px;top:5px;background:linear-gradient(to bottom, #42a5f5 0%, #1e88e5 100%);text-transform:uppercase;padding:6px 12px;box-shadow:inset 0 2px 2px #1976d2;color:white;z-index:114154;padding-right:15px;'
                        a.textContent = "下载视频[loader]";
                        if (article[i].querySelectorAll("div[class='css-175oi2r r-1p0dtai r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-1loqt21']")[0]) {
                            article[i].querySelectorAll("div[class='css-175oi2r r-1p0dtai r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-1loqt21']")[0].appendChild(a);
                        } else {
                            article[i].appendChild(a);
                        }
                    }
                }
            }

        }
    }, 1000)
})();