// ==UserScript== // @name 快手视频批量采集 // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author 李恒道 // @match https://live.kuaishou.com/profile/* // @icon https://www.google.com/s2/favicons?domain=kuaishou.com // @grant unsafeWindow // @grant GM_xmlhttpRequest // @grant GM_setClipboard // @run-at document-start // ==/UserScript== let oldfetch=unsafeWindow.fetch function newobj(){} let savelistid=[] let downloadurl=[] let url=window.location.href function fuckkuaishouvideo(id,index){ return new Promise((resolve, reject) => { GM_xmlhttpRequest({ url:"https://www.kuaishou.com/graphql", method :"POST", data:'{"operationName":"visionVideoDetail","variables":{"photoId":"'+id+'","page":"detail"},"query":"query visionVideoDetail($photoId: String, $type: String, $page: String, $webPageArea: String) {\\n visionVideoDetail(photoId: $photoId, type: $type, page: $page, webPageArea: $webPageArea) {\\n status\\n type\\n author {\\n id\\n name\\n following\\n headerUrl\\n __typename\\n }\\n photo {\\n id\\n duration\\n caption\\n likeCount\\n realLikeCount\\n coverUrl\\n photoUrl\\n liked\\n timestamp\\n expTag\\n llsid\\n viewCount\\n videoRatio\\n stereoType\\n croppedPhotoUrl\\n manifest {\\n mediaType\\n businessType\\n version\\n adaptationSet {\\n id\\n duration\\n representation {\\n id\\n defaultSelect\\n backupUrl\\n codecs\\n url\\n height\\n width\\n avgBitrate\\n maxBitrate\\n m3u8Slice\\n qualityType\\n qualityLabel\\n frameRate\\n featureP2sp\\n hidden\\n disableAdaptive\\n __typename\\n }\\n __typename\\n }\\n __typename\\n }\\n __typename\\n }\\n tags {\\n type\\n name\\n __typename\\n }\\n commentLimit {\\n canAddComment\\n __typename\\n }\\n llsid\\n danmakuSwitch\\n __typename\\n }\\n}\\n"}' ,headers: { "Content-type": "application/json" }, onload:function(xhr){ let obj=JSON.parse(xhr.responseText) let res=obj.data.visionVideoDetail.photo if(res===null){ console.log('失败的id"',id,index) resolve('success') } downloadurl.push(res.photoUrl) resolve('success') } }); }) } function fuckfetch(...bianliang){ return new Promise(function(resolve, reject){ oldfetch(...bianliang).then(function(response) { let handler = { get: function(target, prop, receiver) { if(typeof Reflect.get(target,prop)==='function') { if(Reflect.get(target,prop+'proxy')===undefined) { target[prop+'proxy']=(...funcargs)=> { let result=target[prop].call(target,...funcargs) if(prop==='text'){ if(bianliang.length>=2&&bianliang[1].body!==undefined) { if(bianliang[1].body.indexOf('\"operationName\":\"privateFeedsQuery\"')!==-1||bianliang[1].body.indexOf('\"operationName\":\"publicFeedsQuery\"')!==-1){ if(url!==window.location.href){ url=window.location.href createbtn() } return new Promise(function(resolve, reject){ result.then( function(data){ let list=JSON.parse(data) console.log('获取了list',list) let target=null if(list.data.privateFeeds!==undefined){ target=list.data.privateFeeds } if(list.data.publicFeeds!==undefined){ target=list.data.publicFeeds } if(target!==null){ for(let index=0;index
0->${savelistid.length}
` div.onclick=function(event){ if(event.target.innerText==='下载视频'){ StatToGetVideo() } }; unsafeWindow.document.querySelector('.tab').append(div); } unsafeWindow.onload=createbtn