├── README.md └── 积分脚本 (1).user.js /README.md: -------------------------------------------------------------------------------- 1 | # MS-rewards-script 2 | Microsoft rewards script 3 | ## 运行环境: 4 | 篡改猴 (Tampermonkey) 5 | 6 | ## 功能: 7 | - 任务脚本 8 | - 搜索脚本 9 | - 停止运行 10 | 11 | ### 搜索 12 | 搜索关键词来源:微博热搜,抖音热点 \ 13 | 接口来源:tenapi.cn \ 14 | 每次搜索800~4000的随机时间间隔。 15 | -------------------------------------------------------------------------------- /积分脚本 (1).user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name 积分脚本 3 | // @namespace http://tampermonkey.net/ 4 | // @version 0.1 5 | // @description 任务积分,搜索积分脚本。页面随机延时,搜索关键词来源微博,抖音。 6 | // @author wwwzzz999 7 | // @match https://rewards.bing.com/ 8 | // @match https://rewards.bing.com/?form=dash_2 9 | // @match https://microsoftedgewelcome.microsoft.com/* 10 | // @match https://cn.bing.com/* 11 | // @match https://www4.bing.com/* 12 | // @match https://www.microsoft.com/* 13 | // @connect tenapi.cn 14 | // @icon https:www.google.com/s2/favicons?sz=64&domain=bing.com 15 | // @icon https://www.google.com/s2/favicons?sz=64&domain=bing.com 16 | // @grant GM_setValue 17 | // @grant GM_getValue 18 | // @grant GM_openInTab 19 | // @grant GM_xmlhttpRequest 20 | // @grant GM_deleteValue 21 | // ==/UserScript== 22 | 23 | var slist = []; 24 | const querys = ["weibohot", "douyinhot"]; 25 | // const query= "weibohot"; 26 | // 初始化字典 27 | function setDic(query) { 28 | if (query == 1) { 29 | GM_setValue('query', 0); 30 | } else { 31 | GM_setValue('query', 1); 32 | } 33 | return new Promise(resolve => { 34 | GM_xmlhttpRequest({ 35 | method: "get", 36 | url: 'https://tenapi.cn/v2/' + querys[query], 37 | onload: function (res) { 38 | // console.log(res.response.data); 39 | let data = JSON.parse(res.response); 40 | // console.log(data.data.length); 41 | data = data.data; 42 | for (let i = 0; i < data.length; i++) { 43 | slist.push(data[i].name); 44 | } 45 | GM_setValue("slist", slist); 46 | resolve(); 47 | } 48 | }); 49 | }) 50 | 51 | } 52 | 53 | 54 | 55 | 56 | (async function () { 57 | 'use strict'; 58 | // const randomNumber = Math.floor(Math.random() * (10000 - 3000 + 1)) + 1000; 59 | const randomNumber = Math.floor(Math.random() * (4000 - 500 + 1)) + 500; 60 | // console.log(randomNumber); 61 | 62 | var snum = 0; 63 | // snum = localStorage.getItem('snum'); 64 | snum = GM_getValue("snum", snum); 65 | snum = parseInt(snum, 10); 66 | const timestamp = new Date().getTime(); 67 | 68 | //初始化数据 69 | // GM_deleteValue("slist"); 70 | // var list = []; 71 | // GM_setValue('slist',list); 72 | // console.log(GM_getValue("slist")); 73 | let islist = GM_getValue('slist'); 74 | // 判断字典 75 | if (islist == null || islist.length == 0) { 76 | let query = GM_getValue('query') == null ? 0 : 1; 77 | await setDic(query); 78 | console.log(slist); 79 | } else { 80 | slist = islist; 81 | console.log(slist.length); 82 | // console.log(slist.shift()); 83 | } 84 | 85 | if (!isNaN(snum) && snum > 0) { 86 | setTimeout(function () { 87 | snum = snum - 1; 88 | // localStorage.setItem('snum',snum); 89 | GM_setValue("snum", snum); 90 | const url = "https://cn.bing.com/search?q=" + slist.shift(); // 目标网页的地址 91 | GM_setValue('slist', slist); 92 | window.open(url, "_self"); // 在当前页面中打 开目标网页 93 | }, randomNumber); 94 | 95 | 96 | } 97 | 98 | 99 | 100 | // 执行任务积分 101 | var list_ = GM_getValue("li_href"); 102 | var list = []; 103 | let len_href = 0 104 | if (list_ != null) { 105 | list = list_; 106 | len_href = list.length; 107 | // console.log(list.pop()); 108 | setTimeout(function () { 109 | window.open(list.pop(), "_self"); // 在当前页面中打 开目标网页 110 | GM_setValue('li_href', list); 111 | }, randomNumber); 112 | 113 | } 114 | 115 | 116 | // 创建一个按钮元素 117 | var div = document.createElement('div'); 118 | var button = document.createElement('button'); 119 | var button_ = document.createElement('button'); 120 | var stopb = document.createElement('button'); 121 | div.appendChild(button); 122 | div.appendChild(button_); 123 | div.appendChild(stopb); 124 | 125 | // 设置按钮文本 126 | button.innerHTML = "搜索脚本:" + snum; 127 | button_.innerHTML = '任务脚本' + len_href; 128 | stopb.innerHTML = "停止"; 129 | 130 | // 添加 CSS 样式 131 | div.style.position = 'fixed'; 132 | div.style.bottom = '20px'; 133 | div.style.right = '20px'; 134 | 135 | 136 | 137 | 138 | button.addEventListener('click', function () { 139 | const n = window.prompt('输入搜索次数:'); 140 | var num = parseInt(n, 10); 141 | if (!isNaN(num) && num != 0) { 142 | const url = "https://cn.bing.com/search?q=" + slist.shift(); // 目标网页的地址 143 | GM_setValue('slist', slist); 144 | window.open(url, "_self"); // 在当前页面中打开目标网页 145 | // localStorage.setItem("snum",num-1); 146 | GM_setValue('snum', num - 1); 147 | } 148 | }) 149 | 150 | // 任务积分 151 | button_.addEventListener('click', function () { 152 | //页面判断 153 | let cu_href = window.location.href; 154 | console.log(cu_href); 155 | if (cu_href != "https://rewards.bing.com/") { 156 | // window.alert("页面错误"); 157 | if (confirm("是否跳转")) { 158 | window.open("https://rewards.bing.com/", "_self"); 159 | } 160 | } 161 | // window.location.href = "https://rewards.bing.com/"; 162 | // 获取链接 163 | let li_href = new Array(); 164 | var items = document.getElementsByClassName('ds-card-sec'); 165 | for (let i = 0; i < items.length; i++) { 166 | li_href.push(items[i].href); 167 | } 168 | 169 | setTimeout(function () { 170 | window.open(li_href.pop(), "_self"); 171 | GM_setValue("li_href", li_href); 172 | }, randomNumber); 173 | 174 | // let newtab = window.open("https://www.baidu.com","_self") 175 | }) 176 | 177 | 178 | stopb.addEventListener('click', function () { 179 | // localStorage.setItem('snum',0); 180 | snum = 0; 181 | GM_setValue("snum", snum); 182 | list = []; 183 | GM_setValue("li_href", list); 184 | window.alert("已经停止"); 185 | // return; 186 | }) 187 | 188 | 189 | 190 | 191 | // 将按钮添加到页面中 192 | document.body.appendChild(div); 193 | })(); 194 | --------------------------------------------------------------------------------