抖音视频信息

下载抖音视频 id为名 信息发往服务器

// ==UserScript==
// @name        抖音视频信息
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  下载抖音视频 id为名 信息发往服务器
// @author       You
// @match        https://www.douyin.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant        none
// @license MIT
// ==/UserScript==

(function() {

// 导入axios.pos
let script = document.createElement('script');
 script.src = "https://unpkg.com/axios/dist/axios.min.js";
 document.getElementsByTagName('head')[0].appendChild(script);
// 构造信息
let getDyOne=(info)=>info.length===1?info=info[0]:info[1]
function dyInfo(){
    let dy=new Object()
    dy.stat=document.querySelector('.OFZHdvpl').innerText
    let info=getDyOne(document.querySelectorAll('.video-info-detail'))
    dy.id=info.dataset.e2eAwemeId
    dy.desc=info.innerText

    dy.src=getDyOne(document.querySelectorAll('video')).currentSrc
    dy.reply=getDyOne(document.querySelectorAll('#videoSideBar')).innerText;
    dy.now=new Date().toLocaleString().replaceAll('/','-')
   return dy

}
// 下载视频
function downfile(url,name){
	fetch(url)
	.then(res => res.blob())
	.then(blob => {
		const a = document.createElement("a");
		const objectUrl = window.URL.createObjectURL(blob);
		a.download = name;
		a.href = objectUrl;
		a.click();
		window.URL.revokeObjectURL(objectUrl);
		a.remove();
	})
}
// 发送post 重复不发
let old;

function sendDy(){
    let dy=dyInfo();
    if (old  &&old.id===dy.id)
    return 'skip'

    axios.post('http://localhost:5000/receiver/movie', {
        url: window.location.href,
        data: dy
      })
    //   去重
      old=dy
    //   计数
    //   cnt-=1
    //   if (cnt==0){
    //     clearInterval(inv);
    //     alert('end post')
    //   }
    //   提示在运行
      document.querySelector('title').innerText=dy.id
    //   下载
      downfile(dy.src,dy.id+'.mp4')
      return dy

}
// 延迟重复
window.dvideo=function(){
    setInterval(function() {
        setTimeout(function() {
            let r=sendDy()
            console.log(r)
        },3)
    },1000)
}

}());

QingJ © 2025

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