Bing Rewards

PC/移动端模拟用户操作,获取热搜词进行搜索,搜索后返回继续,持续这个过程,需要手动停止。每四个搜索后间隔15分钟(连续获取积分被风控)。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Bing Rewards
// @description  PC/移动端模拟用户操作,获取热搜词进行搜索,搜索后返回继续,持续这个过程,需要手动停止。每四个搜索后间隔15分钟(连续获取积分被风控)。
// @version      1.0.15
// @match        https://www.bing.com/*
// @match        https://cn.bing.com/*
// @icon         https://www.bing.com/favicon.ico
// @run-at       document-idle
// @grant        GM_xmlhttpRequest
// @connect      *
// @namespace    https://greasyfork.org/users/1363215
// ==/UserScript==

(function () {
    'use strict';
    let timer = null
    const localStorageKeys = {
        current: 'BING_CURRENT_SEARCH',
        searchWords: 'BING_SEARCH_WORDS',
        isActive: 'BING_SEARCH_ACTIVE',
        wordsDate: 'BING_WORDS_DATE',
    }
    const hotType = ['weibo', 'xiaohongshu', 'bilibili', 'douyin', 'toutiao', 'baidu', 'hupu', 'qq']
    const hotTypeLen = hotType.length

    const isToday = (date) => {
        const d = new Date(date);
        const today = new Date();
        return d.toDateString() === today.toDateString();
    };


    const formatDate = (date) => {
        const YYYY = date.getFullYear();
        const MM = (date.getMonth() + 1).toString().padStart(2, '0');
        const DD = date.getDate().toString().padStart(2, '0');
        return `${YYYY}-${MM}-${DD}`;
    };

    const formatTime = (date) => {
        const h = date.getHours().toString().padStart(2, '0');
        const m = date.getMinutes().toString().padStart(2, '0');
        const s = date.getSeconds().toString().padStart(2, '0');
        return `${h}:${m}:${s}`;
    };

    const queryHotWords = () => {
        return new Promise((resolve, reject) => {
            const randomType = Math.floor(Math.random() * hotTypeLen)
            GM_xmlhttpRequest({
                method: 'GET',
                url: 'https://hot.baiwumm.com/api/' + hotType[randomType],
                headers: {
                    "Content-Type": "application/json",
                    "referer": "https://hot.baiwumm.com/",
                    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
                },
                onload: function (response) {
                    console.log(response.responseText);
                    const { code, data } = JSON.parse(response.responseText)
                    if (code === 200) {
                        localStorage.setItem(localStorageKeys.wordsDate, formatDate(new Date()))
                        localStorage.setItem(localStorageKeys.current, '0')
                        localStorage.setItem(localStorageKeys.searchWords, JSON.stringify(data))
                        resolve()
                    }
                },
                onerror: function (e) {
                    console.log(e)
                    reject()
                }
            });
        })
    }

    let current = Number(localStorage.getItem(localStorageKeys.current) || '0')

    function doSearch() {
        const words = JSON.parse(localStorage.getItem(localStorageKeys.searchWords) || '[]')
        const word = words[current]
        const wordsDate = localStorage.getItem(localStorageKeys.wordsDate) || '2026-01-01'
        if (word && isToday(wordsDate)) {
            document.getElementById('sb_form_q')?.click()
            setTimeout(() => {
                document.getElementById('sb_form_q').value = word.title;
                setTimeout(() => {
                    // 文本有时候会丢失,多设置一次
                    document.getElementById('sb_form_q').value = word.title;
                    document.getElementById('sb_form_go').click()
                    localStorage.setItem(localStorageKeys.current, current + 1)
                }, (1 + Math.ceil(Math.random() * 3)) * 1000)
            }, (1 + Math.ceil(Math.random() * 3)) * 1000)
        } else {
            queryHotWords().then(() => { current = 0; setTimeout(doSearch, 1000) })
        }
    }


    function startAction() {
        // h5 页面会有一次奇怪的 pathname 变更
        if (location.pathname === '/') {
            if (current === 0) {
                queryHotWords().then(() => { timer = setTimeout(doSearch, 1000) })
            } else {
                timer = setTimeout(doSearch, 1500)
            }
        }

        if (location.pathname === '/search') {
            if (location.search.includes('form=BHPPHT') || location.search.includes('form=QBLH')) {
                // 每四个搜索后,间隔15-20分钟
                const delay = current % 4 === 0 ? (15 + Math.ceil(Math.random() * 5)) * 60 * 1000 : (10 + Math.ceil(Math.random() * 5)) * 1000
                const $startBtn = document.getElementById('startBtn')
                if ($startBtn) {
                    $startBtn.textContent = 'next:' + formatTime(new Date(delay + new Date().getTime()))
                }
                timer = setTimeout(() => {
                    const $logo = document.getElementsByClassName('b_logoArea')[0]
                    if ($logo) {
                        location.replace($logo.getAttribute('href') || '/')
                    } else {
                        location.replace('/')
                    }
                }, delay)
            }
        }
    }

    function toggleJifen() {
        const isActive = localStorage.getItem(localStorageKeys.isActive)
        const $startBtn = document.getElementById('startBtn')
        if (isActive) {
            $startBtn.textContent = '开始'
            localStorage.removeItem(localStorageKeys.isActive)
            clearTimeout(timer)
        } else {
            $startBtn.textContent = '停止'
            localStorage.setItem(localStorageKeys.isActive, '1')
            startAction()
        }
    }

    if (location.pathname === '/' || location.pathname === '/search') {
        const isActive = localStorage.getItem(localStorageKeys.isActive)
        const actionBtn = document.createElement('button')
        actionBtn.setAttribute('id', 'startBtn')
        actionBtn.textContent = isActive ? '停止' : '开始'
        actionBtn.onclick = toggleJifen
        const nameId = location.pathname === '/' ? 'id_n' : 'id_h'
        const $Name = document.getElementById(nameId)
        $Name.parentNode.insertBefore(actionBtn, $Name)
        if (isActive) {
            startAction()
        }
    }
})();