Greasy Fork

来自缓存

Greasy Fork is available in English.

Microsoft Bing Rewards每日任务脚本 随机暂停

自动完成微软Rewards每日搜索任务,随机暂停时间,增加搜索行为的自然性,约40-55分钟完成。

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Microsoft Bing Rewards每日任务脚本 随机暂停
// @name:zh-TW   Microsoft Bing Rewards每日任務腳本 隨機暫停
// @name:en      Microsoft Bing Rewards Daily Task Script
// @version      V8.0
// @description  自动完成微软Rewards每日搜索任务,随机暂停时间,增加搜索行为的自然性,约40-55分钟完成。
// @description:zh-TW 自動完成微軟Rewards每日任務,隨機暫停時間,增加搜索行為的自然性,約40-55分鐘完成。
// @description:en Automatically complete Microsoft Rewards daily search tasks, with random pause times to enhance the naturalness of search behavior, approximately 40-55 minutes to complete.
// @note         更新于 2026年01月14日
// @author       789cn
// @match        https://*.bing.com/*
// @exclude      https://rewards.bing.com/*
// @license      GNU GPLv3
// @icon         https://www.bing.com/favicon.ico
// @connect      gumengya.com
// @run-at       document-end
// @grant        GM_registerMenuCommand
// @grant        GM_addStyle
// @grant        GM_openInTab
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_xmlhttpRequest
// @namespace    http://greasyfork.icu/zh-TW/scripts/496117
// ==/UserScript==

// 更新日志:
// 2025-10-XX V8.0: 總搜索次數改為固定22次,每次搜索隨機暫停1-3分鐘,每3-5次搜索隨機額外暫停5-8分鐘,預估完成時間約40-55分鐘。


var max_rewards = 22;// 固定22次搜索
var search_words = [];// 搜索词
var appkey = ""; // APIKEY
var Hot_words_apis = "https://api.gmya.net/Api/";

var default_search_words = [
    "今日天气", "今天气温", "安徽阜阳天气预报", "明天会不会下雨",
    "实时空气质量", "今天适合钓鱼吗", "今天气压钓鱼指南", "空气污染指数",
    "今天黄金价格", "当前国际金价多少", "今日白银实时价格", "黄金期货最新行情",
    "1克黄金今天多少钱", "国际金价走势图", "今日铂金价格查询", "黄金回收价",
    "今天上证指数", "恒生指数实时", "美股道琼斯今天多少", "纳斯达克最新指数",
    "人民币兑美元实时汇率", "比特币当前价格", "以太坊今日行情", "原油实时价格",
    "今日猪肉价格", "鸡蛋批发价今天", "全国菜价行情", "今日油价调整情况",
    "今天彩票开奖号码", "当前新冠数据", "今日限行尾号查询", "实时航班延误",
    "今天黄历宜忌", "今日生肖运势", "属相今日运程", "今日星座运势",
    "央行最新LPR报价", "今天存款利率多少", "当前失业率数据", "今日CPI指数",
    "最新PPI数据发布", "今天MLF利率", "全国空气质量排名", "实时高温预警",
    "今日台风路径", "当前地震最新消息", "今天人民币汇率中间价", "美元指数实时"
];

var keywords_source = ['BaiduHot', 'TouTiaoHot', 'DouYinHot', 'WeiBoHot'];
var current_source_index = 0;

// ================== 每日重置 ==================
function checkAndResetDaily() {
    const today = new Date().toDateString();
    const lastReset = GM_getValue('lastReset', '');
    if (lastReset !== today) {
        GM_setValue('Cnt', 0);
        GM_setValue('lastReset', today);
        GM_setValue('stopped', false);
        GM_setValue('next_interval', Math.floor(Math.random() * (5 - 3 + 1)) + 3);
        GM_setValue('searches_since_big', 0);
        return true;
    }
    return false;
}

// ================== 获取热门搜索词 ==================
async function douyinhot_dic() {
    while (current_source_index < keywords_source.length) {
        const source = keywords_source[current_source_index];
        let url = appkey ? Hot_words_apis + source + "?format=json&appkey=" + appkey : Hot_words_apis + source;
        try {
            const response = await fetch(url);
            if (!response.ok) throw new Error('HTTP error! status: ' + response.status);
            const data = await response.json();
            if (data.data.some(item => item)) return data.data.map(item => item.title);
        } catch (error) {
            console.error('搜索词来源请求失败:', error);
        }
        current_source_index++;
    }
    console.error('所有搜索词来源请求失败');
    return default_search_words;
}

// ================== 菜单 ==================
GM_registerMenuCommand('开始', function () {
    GM_setValue('stopped', false);
    checkAndResetDaily();
    location.href = "https://www.bing.com/?br_msg=Please-Wait";
}, 'o');

GM_registerMenuCommand('停止', function () {
    GM_setValue('stopped', true);
    console.log("已停止运行");
}, 'o');

// ================== 工具函数 ==================
function AutoStrTrans(st) {
    let yStr = st, rStr = "", zStr = "", prePo = 0;
    for (let i = 0; i < yStr.length;) {
        let step = parseInt(Math.random() * 5) + 1;
        if (i > 0) {
            zStr = zStr + yStr.substr(prePo, i - prePo) + rStr;
            prePo = i;
        }
        i = i + step;
    }
    if (prePo < yStr.length) zStr = zStr + yStr.substr(prePo, yStr.length - prePo);
    return zStr;
}

function generateRandomString(length) {
    const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
    let result = '';
    for (let i = 0; i < length; i++) result += characters.charAt(Math.floor(Math.random() * characters.length));
    return result;
}

// ================== 悬浮搜索进度提示 ==================
(function () {
    'use strict';
    const floatDiv = document.createElement('div');
    floatDiv.id = 'bingSearchProgress';
    floatDiv.innerText = '[0 / ' + max_rewards + ']';
    document.body.appendChild(floatDiv);

    GM_addStyle(`
        #bingSearchProgress {
            position: fixed;
            top: 100px;
            right: 20px;
            z-index: 9999;
            background: rgba(0,0,0,0.6);
            color: #fff;
            font-size: 18px;
            font-weight: bold;
            padding: 12px 18px;
            border-radius: 10px;
            box-shadow: 0 0 12px rgba(0,0,0,0.5);
            pointer-events: none;
        }
    `);

    function updateProgress() {
        const currentSearchCount = GM_getValue('Cnt', 0);
        floatDiv.innerText = `[${currentSearchCount} / ${max_rewards}]`;
    }

    setInterval(updateProgress, 1000);
    window.updateBingSearchProgress = updateProgress;
})();

// ================== 主执行 ==================
function exec() {
    if (GM_getValue('stopped', false)) {
        console.log("检测到停止标志,脚本终止。");
        return;
    }

    let randomDelay = Math.floor(Math.random() * 20000) + 10000;
    let randomString = generateRandomString(4);
    let randomCvid = generateRandomString(32);

    if (GM_getValue('Cnt') == null) GM_setValue('Cnt', 0);
    let currentSearchCount = GM_getValue('Cnt');

    if (currentSearchCount < max_rewards) {
        // 先递增计数
        currentSearchCount++;
        GM_setValue('Cnt', currentSearchCount);

        let tt = document.getElementsByTagName("title")[0];
        tt.innerHTML = "[" + currentSearchCount + " / " + max_rewards + "] " + tt.innerHTML;

        smoothScrollToBottom();

        setTimeout(function () {
            if (GM_getValue('stopped', false)) return;
            let nowtxt = search_words[currentSearchCount - 1];
            nowtxt = AutoStrTrans(nowtxt);
            let searchUrl = currentSearchCount < max_rewards / 2
                ? `https://www.bing.com/search?q=${encodeURI(nowtxt)}&form=${randomString}&cvid=${randomCvid}`
                : `https://cn.bing.com/search?q=${encodeURI(nowtxt)}&form=${randomString}&cvid=${randomCvid}`;

            // 每次搜索基礎暫停:1~3分鐘
            let small_pause = Math.floor(Math.random() * (180000 - 60000 + 1)) + 60000;

            let total_pause = small_pause;
            let since = GM_getValue('searches_since_big', 0);
            let interval = GM_getValue('next_interval', 3);

            since++;
            if (since >= interval) {
                // 額外大暫停 5~8 分鐘
                let big_pause = Math.floor(Math.random() * (480000 - 300000 + 1)) + 300000;
                total_pause += big_pause;
                since = 0;
                // 下次大暫停間隔重新隨機 3~5
                let new_interval = Math.floor(Math.random() * (5 - 3 + 1)) + 3;
                GM_setValue('next_interval', new_interval);
            }
            GM_setValue('searches_since_big', since);

            setTimeout(function () {
                if (!GM_getValue('stopped', false)) location.href = searchUrl;
            }, total_pause);
        }, randomDelay);
    }

    // 次日零点自动重置
    const now = new Date();
    const msUntilMidnight = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1).getTime() - now.getTime();
    setTimeout(function () {
        if (checkAndResetDaily()) {
            douyinhot_dic().then(names => {
                search_words = names;
                exec();
            }).catch(console.error);
        }
    }, msUntilMidnight);

    function smoothScrollToBottom() {
        document.documentElement.scrollIntoView({ behavior: 'smooth', block: 'end' });
    }
}

// ================== 初始化 ==================
douyinhot_dic().then(names => {
    search_words = names;
    checkAndResetDaily();
    exec();
}).catch(console.error);