Microsoft Bing Rewards每日任务脚本

自动完成微软Rewards每日搜索任务,每次运行时获取抖音/微博/哔哩哔哩/百度/头条热门词,避免使用同样的搜索词被封号。

  1. // ==UserScript==
  2. // @name Microsoft Bing Rewards每日任务脚本
  3. // @version V3.1.1
  4. // @description 自动完成微软Rewards每日搜索任务,每次运行时获取抖音/微博/哔哩哔哩/百度/头条热门词,避免使用同样的搜索词被封号。
  5. // @note 更新于 2025年2月27日
  6. // @author 怀沙2049
  7. // @match https://*.bing.com/*
  8. // @exclude https://rewards.bing.com/*
  9. // @license GNU GPLv3
  10. // @icon https://www.bing.com/favicon.ico
  11. // @connect gumengya.com
  12. // @run-at document-end
  13. // @grant GM_registerMenuCommand
  14. // @grant GM_addStyle
  15. // @grant GM_openInTab
  16. // @grant GM_setValue
  17. // @grant GM_getValue
  18. // @grant GM_xmlhttpRequest
  19. // @namespace https://gf.qytechs.cn/zh-CN/scripts/477107
  20. // ==/UserScript==
  21.  
  22. var max_rewards = 40; //重复执行的次数
  23. //每执行4次搜索后插入暂停时间,解决账号被监控不增加积分的问题
  24. var pause_time = 9; // 暂停时长建议为16分钟,也就是960000(60000毫秒=1分钟)
  25. var search_words = []; //搜索词
  26. var appkey = "";//从https://www.gmya.net/api 网站申请的热门词接口APIKEY
  27. var Hot_words_apis = "https://api.gmya.net/Api/";// 故梦热门词API接口网站
  28.  
  29.  
  30. //默认搜索词,热门搜索词请求失败时使用
  31. var default_search_words = ["盛年不重来,一日难再晨", "千里之行,始于足下", "少年易学老难成,一寸光阴不可轻", "敏而好学,不耻下问", "海内存知已,天涯若比邻", "三人行,必有我师焉",
  32. "莫愁前路无知已,天下谁人不识君", "人生贵相知,何用金与钱", "天生我材必有用", "海纳百川有容乃大;壁立千仞无欲则刚", "穷则独善其身,达则兼济天下", "读书破万卷,下笔如有神",
  33. "学而不思则罔,思而不学则殆", "一年之计在于春,一日之计在于晨", "莫等闲,白了少年头,空悲切", "少壮不努力,老大徒伤悲", "一寸光阴一寸金,寸金难买寸光阴", "近朱者赤,近墨者黑",
  34. "吾生也有涯,而知也无涯", "纸上得来终觉浅,绝知此事要躬行", "学无止境", "己所不欲,勿施于人", "天将降大任于斯人也", "鞠躬尽瘁,死而后已", "书到用时方恨少", "天下兴亡,匹夫有责",
  35. "人无远虑,必有近忧", "为中华之崛起而读书", "一日无书,百事荒废", "岂能尽如人意,但求无愧我心", "人生自古谁无死,留取丹心照汗青", "吾生也有涯,而知也无涯", "生于忧患,死于安乐",
  36. "言必信,行必果", "读书破万卷,下笔如有神", "夫君子之行,静以修身,俭以养德", "老骥伏枥,志在千里", "一日不读书,胸臆无佳想", "王侯将相宁有种乎", "淡泊以明志。宁静而致远,", "卧龙跃马终黄土"]
  37. //{weibohot}微博热搜榜//{douyinhot}抖音热搜榜/{zhihuhot}知乎热搜榜/{baiduhot}百度热搜榜/{toutiaohot}今日头条热搜榜/
  38. var keywords_source = ['BaiduHot', 'TouTiaoHot', 'DouYinHot', 'WeiBoHot'];
  39. var random_keywords_source = keywords_source[Math.floor(Math.random() * keywords_source.length)];
  40. var current_source_index = 0; // 当前搜索词来源的索引
  41.  
  42. /**
  43. * 尝试从多个搜索词来源获取搜索词,如果所有来源都失败,则返回默认搜索词。
  44. * @returns {Promise<string[]>} 返回搜索到的name属性值列表或默认搜索词列表
  45. */
  46. async function douyinhot_dic() {
  47. while (current_source_index < keywords_source.length) {
  48. const source = keywords_source[current_source_index]; // 获取当前搜索词来源
  49. let url;
  50. //根据 appkey 是否为空来决定如何构建 URL地址,如果appkey为空,则直接请求接口地址
  51. if (appkey) {
  52. url = Hot_words_apis + source + "?format=json&appkey=" + appkey;//有appkey则添加appkey参数
  53. } else {
  54. url = Hot_words_apis + source;//无appkey则直接请求接口地址
  55. }
  56. try {
  57. const response = await fetch(url); // 发起网络请求
  58. if (!response.ok) {
  59. throw new Error('HTTP error! status: ' + response.status); // 如果响应状态不是OK,则抛出错误
  60. }
  61. const data = await response.json(); // 解析响应内容为JSON
  62.  
  63. if (data.data.some(item => item)) {
  64. // 如果数据中存在有效项
  65. // 提取每个元素的title属性值
  66. const names = data.data.map(item => item.title);
  67. return names; // 返回搜索到的title属性值列表
  68. }
  69. } catch (error) {
  70. // 当前来源请求失败,记录错误并尝试下一个来源
  71. console.error('搜索词来源请求失败:', error);
  72. }
  73.  
  74. // 尝试下一个搜索词来源
  75. current_source_index++;
  76. }
  77.  
  78. // 所有搜索词来源都已尝试且失败
  79. console.error('所有搜索词来源请求失败');
  80. return default_search_words; // 返回默认搜索词列表
  81. }
  82.  
  83. // 执行搜索
  84. douyinhot_dic()
  85. .then(names => {
  86. // console.log(names[0]);
  87. search_words = names;
  88. exec()
  89. })
  90. .catch(error => {
  91. console.error(error);
  92. });
  93.  
  94. // 定义菜单命令:开始
  95. let menu1 = GM_registerMenuCommand('开始', function () {
  96. GM_setValue('Cnt', 0); // 将计数器重置为0
  97. location.href = "https://www.bing.com/?br_msg=Please-Wait"; // 跳转到Bing首页
  98. }, 'o');
  99.  
  100. // 定义菜单命令:停止
  101. let menu2 = GM_registerMenuCommand('停止', function () {
  102. GM_setValue('Cnt', max_rewards + 10); // 将计数器设置为超过最大搜索次数,以停止搜索
  103. }, 'o');
  104.  
  105. // 自动将字符串中的字符进行替换
  106. function AutoStrTrans(st) {
  107. let yStr = st; // 原字符串
  108. let rStr = ""; // 插入的混淆字符,可以自定义自己的混淆字符串
  109. let zStr = ""; // 结果字符串
  110. let prePo = 0;
  111. for (let i = 0; i < yStr.length;) {
  112. let step = parseInt(Math.random() * 5) + 1; // 随机生成步长
  113. if (i > 0) {
  114. zStr = zStr + yStr.substr(prePo, i - prePo) + rStr; // 将插入字符插入到相应位置
  115. prePo = i;
  116. }
  117. i = i + step;
  118. }
  119. if (prePo < yStr.length) {
  120. zStr = zStr + yStr.substr(prePo, yStr.length - prePo); // 将剩余部分添加到结果字符串中
  121. }
  122. return zStr;
  123. }
  124.  
  125. // 生成指定长度的包含大写字母、小写字母和数字的随机字符串
  126. function generateRandomString(length) {
  127. const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
  128. let result = '';
  129. const charactersLength = characters.length;
  130. for (let i = 0; i < length; i++) {
  131. // 从字符集中随机选择字符,并拼接到结果字符串中
  132. result += characters.charAt(Math.floor(Math.random() * charactersLength));
  133. }
  134. return result;
  135. }
  136.  
  137. function exec() {
  138. // 生成随机延迟时间
  139. let randomDelay = Math.floor(Math.random() * 20000) + 10000; // 生成10秒到30秒之间的随机数
  140. let randomString = generateRandomString(4); //生成4个长度的随机字符串
  141. let randomCvid = generateRandomString(32); //生成32位长度的cvid
  142. 'use strict';
  143.  
  144. // 检查计数器的值,若为空则设置为超过最大搜索次数
  145. if (GM_getValue('Cnt') == null) {
  146. GM_setValue('Cnt', max_rewards + 10);
  147. }
  148.  
  149. // 获取当前搜索次数
  150. let currentSearchCount = GM_getValue('Cnt');
  151. // 根据计数器的值选择搜索引擎
  152. if (currentSearchCount <= max_rewards / 2) {
  153. let tt = document.getElementsByTagName("title")[0];
  154. tt.innerHTML = "[" + currentSearchCount + " / " + max_rewards + "] " + tt.innerHTML; // 在标题中显示当前搜索次数
  155. smoothScrollToBottom(); // 添加执行滚动页面到底部的操作
  156. GM_setValue('Cnt', currentSearchCount + 1); // 将计数器加1
  157. setTimeout(function () {
  158. let nowtxt = search_words[currentSearchCount]; // 获取当前搜索词
  159. nowtxt = AutoStrTrans(nowtxt); // 对搜索词进行替换
  160. // 检查是否需要暂停
  161. if ((currentSearchCount + 1) % 5 === 0) {
  162. setTimeout(function () {
  163. location.href = "https://www.bing.com/search?q=" + encodeURI(nowtxt) + "&form=" + randomString + "&cvid=" + randomCvid; // 在Bing搜索引擎中搜索
  164. }, pause_time);
  165. } else {
  166. location.href = "https://www.bing.com/search?q=" + encodeURI(nowtxt) + "&form=" + randomString + "&cvid=" + randomCvid; // 在Bing搜索引擎中搜索
  167. }
  168. }, randomDelay);
  169. } else if (currentSearchCount > max_rewards / 2 && currentSearchCount < max_rewards) {
  170. let tt = document.getElementsByTagName("title")[0];
  171. tt.innerHTML = "[" + currentSearchCount + " / " + max_rewards + "] " + tt.innerHTML; // 在标题中显示当前搜索次数
  172. smoothScrollToBottom(); // 添加执行滚动页面到底部的操作
  173. GM_setValue('Cnt', currentSearchCount + 1); // 将计数器加1
  174.  
  175. setTimeout(function () {
  176. let nowtxt = search_words[currentSearchCount]; // 获取当前搜索词
  177. nowtxt = AutoStrTrans(nowtxt); // 对搜索词进行替换
  178. // 检查是否需要暂停
  179. if ((currentSearchCount + 1) % 5 === 0) {
  180. setTimeout(function () {
  181. location.href = "https://cn.bing.com/search?q=" + encodeURI(nowtxt) + "&form=" + randomString + "&cvid=" + randomCvid; // 在Bing搜索引擎中搜索
  182. }, pause_time);
  183. } else {
  184. location.href = "https://cn.bing.com/search?q=" + encodeURI(nowtxt) + "&form=" + randomString + "&cvid=" + randomCvid; // 在Bing搜索引擎中搜索
  185. }
  186. }, randomDelay);
  187. }
  188. // 实现平滑滚动到页面底部的函数
  189. function smoothScrollToBottom() {
  190. document.documentElement.scrollIntoView({ behavior: 'smooth', block: 'end' });
  191. }
  192. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址