-哔哩猫-(试用版)

注:练手作品,多多包涵,不接受恶意差评,有问题群内咨询(Q群1031014013):批量播放视频;批量拉黑;批量关注;动态艾特消息提醒(友情天选群746790091 )

当前为 2021-11-15 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/422731/988496/-%E5%93%94%E5%93%A9%E7%8C%AB-%EF%BC%88%E8%AF%95%E7%94%A8%E7%89%88%EF%BC%89.js

  1. // ==UserScript==
  2. // @name -哔哩猫-(试用版)
  3. // @description 注:练手作品,多多包涵,不接受恶意差评,有问题群内咨询(Q群1031014013):批量播放视频;批量拉黑;批量关注;动态艾特消息提醒(友情天选群746790091 )
  4. // @namespace http://tampermonkey.net/
  5. // @version 2.4.93
  6. // @iconURL https://gitee.com/java_cn/BILIBLI_RES/raw/master/PIC/PC_1606377718.gif
  7. // @author 荒年(QQ:2019676120)
  8. // @match *://space.bilibili.com/*
  9. // @match *://www.bilibili.com/v/newbie/*
  10. // @match *://www.bilibili.com/judgement/*
  11. // @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js
  12. // @require https://cdn.jsdelivr.net/gh/java-xiaoyi/HNGG-RES@ea375a9d65253039a2ef8cde53b6a3cf421a022c/javaex/pc/js/javaex.min.js
  13. // @require https://cdn.jsdelivr.net/gh/java-xiaoyi/HNGG-RES@ea375a9d65253039a2ef8cde53b6a3cf421a022c/javaex/pc/js/javaex-formVerify.js
  14. // @resource animate http://cdn.javaex.cn/javaex/pc/css/animate.css
  15. // @resource common http://cdn.javaex.cn/javaex/pc/css/common.css
  16. // @resource defaultCss http://cdn.javaex.cn/javaex/pc/css/skin/default.css
  17. // @grant unsafeWindow
  18. // @grant GM_getValue
  19. // @grant GM_setValue
  20. // @grant GM_xmlhttpRequest
  21. // @grant GM_getResourceText
  22. // @grant GM_setClipboard
  23. // @grant GM_openInTab
  24. // @grant GM_addStyle
  25. // @run-at document-idle
  26. // @license MIT License
  27. // @connect github.com
  28. // @connect gitee.com
  29. // @connect api.bilibili.com
  30. // @connect qmsg.zendee.cn
  31. // @connect biliapi.net
  32. // @connect qcloud-sdkact-api.biligame.com
  33. // @connect passport.bilibili.com
  34. // @connect api.live.bilibili.com
  35. // @connect mcloc.cn
  36. // @namespace http://tampermonkey.net/
  37. // ==/UserScript==
  38.  
  39.  
  40.  
  41.  
  42. GM_addStyle(
  43. `
  44.  
  45. #switch-qsmg:before {
  46. content: "开关";
  47. letter-spacing: 16px;
  48. top: 4px;
  49. left: 10px;
  50. }
  51. #left_navbar{
  52. z-index: 1000;
  53. position: absolute;
  54. top: 100px;
  55. left: 5px;
  56. }
  57. button[hnBtn="btn_open"] {
  58. z-index: 1001;
  59. z-index: 1000px;
  60. position: absolute;
  61. top: 58px;
  62. left: 220px;
  63. }
  64. .javaex-panel.javaex-panel-right.javaex-animated-zoom-in {
  65. top: 60px;
  66. }
  67. .javaex-menu-container {
  68. border: 1px solid #eee;
  69. }
  70. .javaex-panel-box p {
  71. text-align: center;
  72. background: #fb7299;
  73. }
  74. .fontbold{
  75. color: #00a1d6;
  76. font-weight: bold;
  77. cursor: pointer;
  78. }
  79. .hideLogo {
  80. position: absolute;
  81. top: 88px;
  82. left: 10px;
  83. width: 50px;
  84. height: 57px;
  85. z-index: 9999;
  86. cursor: pointer;
  87. }
  88. #auto_check_question {
  89. position: absolute;
  90. border-radius: 20%;
  91. font-size: 24px;
  92. text-align: center;
  93. border: 2px solid red;
  94. top: 91%;
  95. right: 44%;
  96. width: 81px;
  97. color: #fff;
  98. cursor: pointer;
  99. z-index: 999;
  100. }
  101. `
  102. );
  103.  
  104.  
  105. let HN_SETUP_CONFIG = {
  106.  
  107. qmsg_key: null, //后期改为kull 存储到本地
  108. qmsg_checked: false,
  109. Booking_last_sid: null,
  110. }
  111.  
  112. let replyList = ["哇⊙ω⊙", "仙女震惊", "都关注这么久了给个吧", "大佬,看下孩子吧,这次一定", "会有我吗?黑幕一手",
  113. "酋长在线拉低中奖率", "好耶(✪▽✪)", "好运", "希望欧一次", "永不缺席", " 永不中奖", " 永不放弃!", "万一呢", "在", "冲吖~", "来了",
  114. "芜湖,都想要,抽中那个都不亏阿", "从未中,从未停", "来力", "秋", "懂我意思吧", "今天去吃面", "从不缺席",
  115. "站友保佑抽到", "可以", "恰", "不会吧", "233", "好耶", "rush", "来了!!!", "来来", "ok", "冲", "凑热闹", "我要我要", "我还能中!", "让我中!!!",
  116. "是我的", "我是天选之子?", "给我中一次吧!", "坚持不懈,迎难而上", "开拓创新!", "我来抽个奖", "中中中中中", "我我我", "搞笑 这不得转", "我下手了",
  117. "看这里就想中一次", "不可能", "我不挑,都可以", "俺要当分母", "万一呢"
  118. ]
  119.  
  120.  
  121. let Live_info = {
  122. room_id: undefined,
  123. uid: undefined,
  124. blocked: undefined,
  125. csrf_token: undefined,
  126. SESSDATA: undefined,
  127. visit_id: undefined,
  128. rnd: undefined,
  129. ruid: undefined,
  130. uname: undefined,
  131. user_level: undefined,
  132. ruid: undefined,
  133. };
  134.  
  135. let BILIBLI_PATH = {
  136.  
  137. "live": "https://api.live.bilibili.com",
  138. "vcapi": "https://api.vc.bilibili.com",
  139. "passport": "https://passport.bilibili.com",
  140. "api": "https://api.bilibili.com",
  141. "video": "https://www.bilibili.com/video/",
  142. "single_unread": "http://api.vc.bilibili.com/",
  143.  
  144. }
  145.  
  146. let BILIBILI_URL = {
  147. // 导航栏用户信息
  148. "nav": BILIBLI_PATH.api + "/x/web-interface/nav",
  149. }
  150.  
  151. let BiliData = {
  152.  
  153. this_uid: window.location.href.split("/")[3], //当前页面uid
  154. author_uid: 99439379,
  155. login_code: null,
  156. login_message: "",
  157. LoginData: {},
  158. CoinLog: {},
  159. Unread: null,
  160. Video: {},
  161. replyAction: {},
  162. upCard: {},
  163. BVList: [],
  164. }
  165.  
  166. window.onload = function() {
  167.  
  168.  
  169. //界面显示
  170. init();
  171.  
  172.  
  173.  
  174. addHideLogo();
  175.  
  176.  
  177. /* var myVar = setInterval(function() {
  178. console.log("yunxing");
  179. AA ();
  180.  
  181. }, 1000);
  182.  
  183.  
  184. function AA (){
  185. if ((new Date()).getMinutes() == 47) {
  186.  
  187. console.log("stop");
  188. clearInterval(myVar);
  189. }
  190. } */
  191.  
  192.  
  193. }
  194.  
  195. function addHideLogo() {
  196.  
  197. let isHide = true;
  198.  
  199. $("#left_navbar").after(
  200. '<div id="hideLogo" class="hideLogo"> <img src="https://gitee.com/java_cn/BILIBLI_RES/raw/master/PIC/PC_1606377718.gif" alt="点击显示隐藏" width="100%" height="100%"></div>'
  201. );
  202. if (isHide) {
  203. $("#left_navbar").hide();
  204. isHide = false;
  205. } else {
  206. isHide = true;
  207. }
  208. $("#hideLogo").bind("click", async function() {
  209.  
  210. if (isHide) {
  211. $("#left_navbar").hide();
  212. isHide = false;
  213. } else {
  214. $("#left_navbar").show();
  215. isHide = true;
  216. }
  217. });
  218.  
  219. let newbie = window.location.href.indexOf("newbie") > -1;
  220. if (newbie) {
  221. $("#hideLogo").hide();
  222. //document.querySelector(".tv-type-text").innerHTML += '<span id="auto_check_question">答题</span>';
  223. $("#basic-1").after('<span id="auto_check_question">答题</span>');
  224. $("#basic-2").after('<span id="auto_check_question">答题</span>');
  225.  
  226. $("#optional-qa").after('<span id="auto_check_question">答题</span>');
  227.  
  228. }
  229.  
  230. /**
  231. * 一键答题
  232. */
  233.  
  234. $("#auto_check_question").bind("click", async function() {
  235.  
  236. for (let i = 0; i < 60; i++) {
  237.  
  238. //1.查询状态
  239. let status = await HNAPI.answer_status();
  240. await HNTOOL.Sleep(1000);
  241.  
  242. if (status.progress == 100) {
  243. let submitData = {
  244. "re_src": 0,
  245. "csrf": Live_info.csrf_token,
  246. }
  247. let submitReul = await HNAPI.basePost("https://api.bilibili.com/x/answer/v4/submit",submitData);
  248. window.location.reload();
  249. }
  250.  
  251. if (status.status != 3 && status.result == "failed") {
  252. // 基础题
  253. if (status.stage == "base") {
  254. //拉取题目
  255. let base = await HNAPI.pull_answer("base");
  256. if (base == 1) {
  257. continue;
  258. }
  259. if (base == false) {
  260. alert("基础题答题错误:答题过快或错误太多||用户答题记录不存在");
  261. break;
  262. }
  263. let question = base.question;
  264. for (let j = 0, len = question.options.length; j < len; j++) {
  265.  
  266. //1.答题
  267. let check = await HNAPI.answer_check(question.id, question.options[j].hash, "base");
  268. if (check == 1) {
  269. continue;
  270. }
  271. await HNTOOL.Sleep(1000);
  272. if (check.passed == true) {
  273. console.log("开始基础题第" + question.number + "题!---当前得分:" + status.score);
  274. javaex.tip({
  275. content: "开始基础题第" + question.number + "题!---当前得分:" + status.score,
  276. type: "success"
  277. });
  278. break;
  279. }
  280. }
  281.  
  282.  
  283. //附加题
  284. } else if (status.stage == "extra") {
  285.  
  286. //拉取题目
  287. let extra = await HNAPI.pull_answer("extra");
  288. if (extra == 1) {
  289. continue;
  290. }
  291. if (extra == false) {
  292. alert("违规发言题答题错误:答题过快或错误太多||用户答题记录不存在");
  293. break;
  294. }
  295. let question = extra.question;
  296. let check = await HNAPI.answer_check(question.id, question.options[0].hash, "extra");
  297. await HNTOOL.Sleep(1000);
  298. if (check == 1) {
  299. continue;
  300. }
  301. if (check.passed == true) {
  302. console.log("开始违规发言题第" + question.number + "题!---当前得分:" + status.score);
  303. javaex.tip({
  304. content: "开始违规发言题第" + question.number + "题!---当前得分:" + status.score,
  305. type: "success"
  306. });
  307. if (question.number == 50) {
  308. window.location.reload();
  309. }
  310. }
  311.  
  312. } else if (status.stage == "pro") {
  313.  
  314. //拉取题目
  315. let pro = await HNAPI.pull_answer("pro");
  316. if (pro == 1) {
  317. continue;
  318. }
  319. if (pro == false) {
  320. alert("自选题答题错误:答题过快或错误太多||用户答题记录不存在");
  321. break;
  322. }
  323. let question = pro.question;
  324. let num = HNTOOL.random(0, question.options.length);
  325. let check = await HNAPI.answer_check(question.id, question.options[num].hash, "pro");
  326. await HNTOOL.Sleep(1000);
  327. if (check == 1) {
  328. continue;
  329. }
  330. if (check.passed == true) {
  331. console.log("开始自选题第" + question.number + "题!---当前得分:" + status.score);
  332. javaex.tip({
  333. content: "开始自选题第" + question.number + "题!---当前得分:" + status.score,
  334. type: "success"
  335. });
  336.  
  337. }
  338.  
  339. } else {
  340. break;
  341. }
  342.  
  343. }
  344.  
  345. }
  346.  
  347. });
  348.  
  349.  
  350. }
  351.  
  352.  
  353. function init() {
  354.  
  355. Live_info.csrf_token = HNTOOL.getCookie("bili_jct");
  356. Live_info.uid = HNTOOL.getCookie("DedeUserID");
  357. Live_info.SESSDATA = HNTOOL.getCookie("SESSDATA");
  358.  
  359. HN_SETUP_CONFIG.Booking_last_sid = Live_info.uid + "&54988";
  360.  
  361.  
  362. addStyle();
  363. addSetPage();
  364.  
  365. HNTOOL.chackAtMsg();
  366.  
  367. $("#getCoinLog").bind("click", async function() {
  368.  
  369.  
  370. if (HNAPI.getCoinLog()) {
  371.  
  372. await HNTOOL.Sleep(500);
  373. let html = '';
  374. html += '<div class="javaex-panel-box" style="width: 250px;">';
  375. html += ' <ul>';
  376. html += ` <p style="color: #FFF;">硬币使用记录</p>`;
  377.  
  378. BiliData.CoinLog.list.forEach(function(item) {
  379.  
  380. let BV = item.reason.replace(/[^a-z0-9]+/ig, "");
  381. if (BV.indexOf("BV") != -1) {
  382. html +=
  383. `<li><a href="${BILIBLI_PATH.video}${BV}">${item.reason}${item.delta}币 ${item.time}</a> </li> `;
  384. }
  385. html += `<li>${item.reason}${item.delta}币 ${item.time}</li> `;
  386.  
  387.  
  388. });
  389. html += ' <hr class="javaex-divider"></hr>';
  390. html += ' </ul>';
  391. html += '</div>';
  392.  
  393. javaex.panel(this, {
  394. position: "right",
  395. //offsetTop: "104",
  396. content: html
  397. });
  398. javaex.tip({
  399. content: "获取用户成功!",
  400. type: "success"
  401. });
  402.  
  403. } else {
  404. javaex.tip({
  405. content: "获取硬币记录失败,请稍后重试!",
  406. type: "error"
  407. });
  408. }
  409.  
  410.  
  411. });
  412.  
  413. $("#getUnread").bind("click", async function() {
  414.  
  415. javaex.tip({
  416. content: "获取中,请稍候...",
  417. type: "submit"
  418. });
  419. HNAPI.getUnread();
  420.  
  421.  
  422. });
  423.  
  424.  
  425. $("#likeInDynamicComments").bind("click", async function() {
  426.  
  427. let prid = LocalData.get("likeInDynamic_PRID") == null ? "4015599048" : LocalData.get(
  428. "likeInDynamic_PRID");
  429. let oid = LocalData.get("likeInDynamic_OID") == null ? "108928314" : LocalData.get(
  430. "likeInDynamic_OID");
  431.  
  432. let html = '';
  433.  
  434. html += '<div style="padding: 10px 10px 10px 0px;">'
  435. html += '<form id="likeInDynamic_form">'
  436. html += ' <div class="javaex-unit clear">'
  437. html += ' <div class="javaex-unit-left"><p class="subtitle required">评论RPID</p></div>'
  438. html += ' <div class="javaex-unit-right">'
  439. html +=
  440. ' <input type="text" class="javaex-text" data-type="positive_int" error-msg="评论RPID格式错误"'
  441. html += ` id="likeInDynamic_PRID" value=${prid} placeholder="请输入评论RPID"/>`
  442. html += ' </div>'
  443. html += ' </div>'
  444. html += ' <div class="javaex-unit clear">'
  445. html += ' <div class="javaex-unit-left"><p class="subtitle required">OID</p></div>'
  446. html += ' <div class="javaex-unit-right">'
  447. html +=
  448. ' <input type="text" class="javaex-text" data-type="positive_int" error-msg="OID格式错误"'
  449. html += ` id="likeInDynamic_OID" value=${oid} placeholder="请输入OID"/>`
  450. html += ' </div>'
  451. html += ' </div>'
  452. html += ' <div class="javaex-unit clear tc">'
  453. html +=
  454. ' <input type="button" id="likeInDynamic_no" class="javaex-hover-pulse javaex-btn no " value="取消赞"/>'
  455. html +=
  456. ' <input type="button" id="likeInDynamic_yes" class="javaex-hover-pulse javaex-btn yes" value="点赞"/>'
  457. html += ' </div>'
  458. html += '</form>';
  459. html += '<hr class="javaex-divider"></hr>';
  460. html += '</div>';
  461.  
  462.  
  463. javaex.panel(this, {
  464. position: "right",
  465. content: html
  466. });
  467.  
  468.  
  469. // 监听点击保存按钮事件
  470. $("#likeInDynamic_yes").click(async function() {
  471. // 表单验证函数
  472. if (javaexVerify()) {
  473.  
  474. HNAPI.likeInDynamicComments(+javaex.getSelectVal("#likeInDynamic_OID"), +javaex
  475. .getSelectVal(
  476. "#likeInDynamic_PRID"), 1);
  477. await HNTOOL.Sleep(1000);
  478.  
  479. if (BiliData.replyAction.code == 0) {
  480.  
  481. LocalData.set("likeInDynamic_PRID", javaex.getSelectVal(
  482. "#likeInDynamic_PRID"));
  483. LocalData.set("likeInDynamic_OID", javaex.getSelectVal(
  484. "#likeInDynamic_OID"));
  485.  
  486. javaex.tip({
  487. content: "评论区点赞成功!",
  488. type: "success"
  489. });
  490. } else {
  491. javaex.tip({
  492. content: "评论区点赞失败!",
  493. type: "error"
  494. });
  495. }
  496. if (BiliData.replyAction.code == 65006) {
  497. javaex.tip({
  498. content: "请勿重复点赞!",
  499. type: "error"
  500. });
  501. }
  502. }
  503. });
  504.  
  505. // 监听点击返回按钮事件
  506. $("#likeInDynamic_no").click(async function() {
  507.  
  508. if (javaexVerify()) {
  509.  
  510. HNAPI.likeInDynamicComments(+javaex.getLocalStorage("#likeInDynamic_OID"), +
  511. javaex.getLocalStorage(
  512. "#likeInDynamic_PRID"), 0);
  513. await HNTOOL.Sleep(500);
  514.  
  515. if (BiliData.replyAction.code == 0) {
  516.  
  517. javaex.setLocalStorage("likeInDynamic_PRID", javaex.getSelectVal(
  518. "#likeInDynamic_PRID"));
  519. javaex.setLocalStorage("likeInDynamic_OID", javaex.getSelectVal(
  520. "#likeInDynamic_OID"));
  521.  
  522. javaex.tip({
  523. content: "评论区取消点赞成功!",
  524. type: "success"
  525. });
  526. } else {
  527. javaex.tip({
  528. content: "评论区取消点赞失败!",
  529. type: "error"
  530. });
  531. }
  532. if (BiliData.replyAction.code == 65006) {
  533. javaex.tip({
  534. content: "请勿重复取消点赞!",
  535. type: "error"
  536. });
  537. }
  538. }
  539. });
  540.  
  541. });
  542.  
  543. $("#biliUserMsg").bind("click", async function() {
  544.  
  545.  
  546. //刷新信息
  547. HNAPI.getUserNav();
  548. await HNTOOL.Sleep(500);
  549.  
  550. let isLogin = "未登录";
  551. let vipType = "无";
  552. //判断是否成功
  553. if (BiliData.login_code == 0) {
  554.  
  555.  
  556. if (BiliData.LoginData.isLogin) {
  557. isLogin = "已登录";
  558. }
  559.  
  560. if (BiliData.LoginData.vipType == 1) {
  561. vipType = "月度大会员";
  562. } else if (BiliData.LoginData.vipType == 2) {
  563. vipType = "年度大会员";
  564. }
  565.  
  566. let html = '';
  567. html += '<div class="javaex-panel-box" style="width: 250px;">';
  568. html += ' <ul>';
  569. html += ` <p style="color: #FFF;">用户信息</p>`;
  570. html +=
  571. ` <li><a href="https://account.bilibili.com/account/home">当前用户:${BiliData.LoginData.uname}</a> </li> `;
  572. html += ` <li>用户状态:${isLogin} </li> `;
  573. html += ` <li>用户等级:${BiliData.LoginData.level_info.current_level}</li> `;
  574. html +=
  575. ` <li>升级下一等级需:${BiliData.LoginData.level_info.next_exp - BiliData.LoginData.level_info.current_exp} 经验</li> `;
  576. html += ` <li>UID${BiliData.LoginData.mid} </li> `;
  577. html +=
  578. ` <li><a href="https://account.bilibili.com/account/coin">硬币:${BiliData.LoginData.money}</a> </li> `;
  579. html += ` <li>节操值:${BiliData.LoginData.moral} </li> `;
  580. html += ` <li>会员:${vipType} </li> `;
  581. html += ' <hr class="javaex-divider"></hr>';
  582. html += ' </ul>';
  583. html += '</div>';
  584.  
  585.  
  586. javaex.panel(this, {
  587. position: "right",
  588. content: html
  589. });
  590.  
  591. javaex.tip({
  592. content: "获取用户成功!",
  593. type: "success"
  594. });
  595.  
  596. } else {
  597. javaex.tip({
  598. content: "获取用户信息失败!",
  599. type: "error"
  600. });
  601. }
  602.  
  603.  
  604. });
  605.  
  606. $("#getAtMsg").bind("click", async function() {
  607.  
  608. if (HNAPI.getMsgfeed("at") && typeof(HNAPI.getMsgfeed("at")) != "undefined") {
  609.  
  610. javaex.tip({
  611. content: "可能中奖了!!!",
  612. type: "success"
  613. });
  614. }
  615. });
  616.  
  617.  
  618. $("#disUser").bind("click", async function() {
  619.  
  620. let html = '';
  621. html += '<div class="javaex-panel-box" style="width: 500px;">';
  622. html += ' <div class="javaex-unit clear">';
  623. html += ' <div class="javaex-unit-left ml-10 mt-10">*UID列表</div>';
  624. html += ' <div class="javaex-unit-right mr-10 mt-10">';
  625. html +=
  626. ' <textarea id="disUser_uidList" class="javaex-desc" placeholder="请填写用户UID,多个用英文逗号,隔开"></textarea>';
  627. html += ' </div>';
  628. html += ' </div>';
  629. html += ' <div class="javaex-unit clear tc">';
  630. html += ' <input type="button" id="disUser_block" class="javaex-btn yes" value="拉黑" />';
  631. html +=
  632. ' <input type="button" id="disUser_cancelAtt_uid" class="javaex-btn yes" value="UID取关" />';
  633. html +=
  634. ' <input type="button" id="disUser_cancelAtt_room" class="javaex-btn yes" value="房间号取关" />';
  635. html += ' </div>';
  636. html += '</div>';
  637.  
  638. javaex.panel(this, {
  639. position: "right",
  640. content: html
  641. });
  642.  
  643. let disUser_str;
  644. //拉黑
  645. $("#disUser_block").bind("click", async function() {
  646.  
  647. disUser_str = javaex.getSelectVal("#disUser_uidList");
  648. let disUser_uidList = disUser_str.split(",");
  649. let disUserStr = HNTOOL.split_array(disUser_uidList, 10);
  650.  
  651. for (const vmid of disUserStr) {
  652.  
  653. HNAPI.batchModify(vmid.toString(), 5);
  654. await HNTOOL.Sleep(2000);
  655. }
  656. });
  657. //取关uid
  658. $("#disUser_cancelAtt_uid").bind("click", async function() {
  659. disUser_str = javaex.getSelectVal("#disUser_uidList");
  660. let disUser_uidList = disUser_str.split(",");
  661.  
  662. javaex.tip({
  663. content: "根据uid批量取关开始!!!",
  664. type: "success"
  665. });
  666.  
  667. /*
  668. let disuidList = [];
  669. let PN = 100;
  670. PN = disUser_uidList.length == 1 ? 0 : PN;
  671.  
  672. for (var i = 0; i < PN; i++) {
  673.  
  674. let uidList = await HNAPI.getDisuidList(HNTOOL.getCookie("DedeUserID"), i);
  675. javaex.tip({
  676. content: "获取第" + i + "页黑名单成功!",
  677. type: "success"
  678. });
  679. await HNTOOL.Sleep(1000);
  680.  
  681. if (uidList.length == 0) {
  682. break;
  683. }
  684. if (uidList == null) {
  685. continue;
  686. }
  687.  
  688. for (let disuid of uidList) {
  689. if (disuidList.indexOf(disuid.mid) == -1) {
  690. disuidList.push(disuid.mid + "");
  691. }
  692. }
  693.  
  694.  
  695. } */
  696. let J = 1;
  697.  
  698. for (let uid of disUser_uidList) {
  699.  
  700. /* let uidType = "未在黑名单";
  701. if (disuidList.indexOf(uid) == -1) {
  702.  
  703. await HNAPI.cancelAtt(uid, 2);
  704. } else {
  705.  
  706. await HNAPI.cancelAtt(uid, 6, 116);
  707. uidType = "黑名单用户";
  708. } */
  709. await HNAPI.cancelAtt(uid, 2);
  710.  
  711. javaex.tip({
  712. content: "【UID:" + uid + "】" + "取关成功!(" + (J++) + "/" +
  713. disUser_uidList.length + ")",
  714. type: "success"
  715. });
  716. await HNTOOL.Sleep(1000);
  717. }
  718.  
  719.  
  720. alert("根据uid批量取关完成!");
  721.  
  722. /* javaex.alert({
  723. content: "根据uid批量取关完成!",
  724. confirm: function() {
  725.  
  726. //return false;
  727. }
  728. }); */
  729.  
  730. });
  731. //取关room
  732. $("#disUser_cancelAtt_room").bind("click", async function() {
  733.  
  734. javaex.tip({
  735. content: "根据房间号批量取关开始!!!",
  736. type: "success"
  737. });
  738.  
  739. disUser_str = javaex.getSelectVal("#disUser_uidList");
  740. let disUser_roomList = disUser_str.split(",");
  741. /* let disuidList = [];
  742. let PN = 100;
  743. PN = disUser_roomList.length == 1 ? 0 : PN;
  744.  
  745. for (var i = 0; i < PN; i++) {
  746.  
  747. let uidList = await HNAPI.getDisuidList(HNTOOL.getCookie("DedeUserID"), i);
  748. javaex.tip({
  749. content: "获取第" + i + "页黑名单成功!",
  750. type: "success"
  751. });
  752. await HNTOOL.Sleep(1000);
  753.  
  754. if (uidList.length == 0) {
  755. break;
  756. }
  757. if (uidList == null) {
  758. continue;
  759. }
  760.  
  761. for (let disuid of uidList) {
  762.  
  763. if (disuidList.indexOf(disuid.mid) == -1) {
  764. disuidList.push(disuid.mid);
  765. }
  766.  
  767. }
  768.  
  769.  
  770. } */
  771. let J = 1;
  772. for (let room of disUser_roomList) {
  773.  
  774. let uid = await HNAPI.getRoomMsg(room);
  775.  
  776. await HNTOOL.Sleep(1000);
  777.  
  778. if (uid == false) {
  779. javaex.tip({
  780. content: "uid查询失败跳过!",
  781. type: "error"
  782. });
  783. continue;
  784. }
  785. /* let uidType = "未在黑名单";
  786. if (disuidList.indexOf(uid) == -1) {
  787.  
  788. await HNAPI.cancelAtt(uid, 2);
  789. } else {
  790.  
  791. await HNAPI.cancelAtt(uid, 6, 116);
  792. uidType = "黑名单用户";
  793. } */
  794. await HNAPI.cancelAtt(uid, 2);
  795.  
  796. javaex.tip({
  797. content: "Room:" + room + "-【UID:" + uid + "】" + "取关成功!(" + (J++) +
  798. "/" + disUser_roomList.length +
  799. ")",
  800. type: "success"
  801. });
  802. await HNTOOL.Sleep(1000);
  803.  
  804.  
  805. }
  806. alert("根据房间号批量取关完成!");
  807. /* javaex.alert({
  808. content: ,
  809. confirm: function() {
  810.  
  811. return false;
  812. }
  813. }); */
  814.  
  815. });
  816.  
  817. });
  818.  
  819. $("#getNeetCookie").bind("click", async function() {
  820.  
  821. let html = '';
  822. html += '<div class="javaex-panel-box" style="width: 750px;">';
  823. html += ' <div class="javaex-unit clear">';
  824. html += ' <div class="javaex-unit-left ml-10 mt-10">*cookie</div>';
  825. html += ' <div class="javaex-unit-right mr-10 mt-10">';
  826. html +=
  827. ' <textarea id="neetCookie" class="javaex-desc" placeholder="获取需要的cookie,注意需要取消掉application->cookie>SESSDATA httpOnly 的对钩"></textarea>';
  828. html += ' </div>';
  829. html += ' </div>';
  830. html += ' <div class="javaex-unit clear tc">';
  831. html += ' <input type="button" id="getCookie_type1" class="javaex-btn yes" value="方式一" />';
  832. html += ' <input type="button" id="getCookie_type2" class="javaex-btn yes" value="方式二" />';
  833. html += ' <input type="button" id="getCookie_type3" class="javaex-btn yes" value="方式三" />';
  834. html += ' <input type="button" id="getCookie_copy" class="javaex-btn yes" value="复制" />';
  835. html += ' </div>';
  836. html += '</div>';
  837.  
  838. javaex.panel(this, {
  839. position: "right",
  840. content: html
  841. });
  842.  
  843. $('#getCookie_copy').bind('click', function() {
  844.  
  845. HNTOOL.copyText("neetCookie");
  846.  
  847. });
  848.  
  849. Live_info.csrf_token = HNTOOL.getCookie("bili_jct");
  850. Live_info.uid = HNTOOL.getCookie("DedeUserID");
  851. Live_info.SESSDATA = HNTOOL.getCookie("SESSDATA");
  852.  
  853.  
  854. $("#getCookie_type1").bind("click", async function() {
  855.  
  856. var cookie01 = "DedeUserID=" + Live_info.uid + "; SESSDATA=" + Live_info.SESSDATA
  857. .replace(/%25/g, "%") +
  858. "; bili_jct=" + Live_info.csrf_token +
  859. "; "
  860. document.getElementById("neetCookie").value = cookie01;
  861.  
  862. });
  863. $("#getCookie_type3").bind("click", async function() {
  864.  
  865. var cookie01 = "DedeUserID=" + Live_info.uid + "; SESSDATA=" + Live_info.SESSDATA
  866. .replace(/%25/g, "%%") +
  867. "; bili_jct=" + Live_info.csrf_token +
  868. "; "
  869. document.getElementById("neetCookie").value = cookie01;
  870.  
  871. });
  872.  
  873. $("#getCookie_type2").bind("click", async function() {
  874.  
  875. var cookie02 = Live_info.uid + "\n" + Live_info.SESSDATA.replace(/%25/g, "%") +
  876. "\n" + Live_info.csrf_token;
  877. document.getElementById("neetCookie").value = cookie02;
  878. });
  879.  
  880. });
  881.  
  882. $("#arrUnique").bind("click", async function() {
  883.  
  884. let html = '';
  885. html += '<div class="javaex-panel-box" style="width: 500px;">';
  886. html += ' <div class="javaex-unit clear">';
  887. html += ' <div id="arrNub" class="javaex-unit-left ml-10 mt-10">*数组0</div>';
  888. html += ' <div class="javaex-unit-right mr-10 mt-10">';
  889. html +=
  890. ' <textarea id="arrUnique_str" class="javaex-desc" placeholder="请填写,多个用英文逗号,隔开"></textarea>';
  891. html += ' </div>';
  892. html += ' </div>';
  893. html += ' <div class="javaex-unit clear tc">';
  894. html += ' <input type="button" id="arrUnique_beg" class="javaex-btn yes" value="去重" />';
  895. //html += ' <input type="button" id="arrUnique_copy" class="javaex-btn yes" value="粘贴" />';
  896. html += ' <input type="button" id="arrUnique_copy" class="javaex-btn yes" value="复制" />';
  897. html += ' </div>';
  898. html += '</div>';
  899.  
  900. javaex.panel(this, {
  901. position: "right",
  902. content: html
  903. });
  904.  
  905. $('#arrUnique_str').bind('input propertychange', function() {
  906.  
  907. $('#arrNub').text("*数组" + $(this).val().split(",").length);
  908.  
  909. });
  910. $('#arrUnique_copy').bind('click', function() {
  911.  
  912. HNTOOL.copyText("arrUnique_str");
  913.  
  914. });
  915.  
  916.  
  917.  
  918.  
  919. $("#arrUnique_beg").bind("click", async function() {
  920.  
  921. let arrUnique_str = javaex.getSelectVal("#arrUnique_str");
  922. let arrUnique_uidList = arrUnique_str.split(",");
  923.  
  924. let new_arr = HNTOOL.arrUnique(arrUnique_uidList);
  925.  
  926. document.getElementById("arrUnique_str").value = new_arr.toString();
  927.  
  928. $('#arrNub').text("*数组" + new_arr.length);
  929.  
  930. });
  931.  
  932. });
  933.  
  934. $("#batchFollow").bind("click", async function() {
  935.  
  936. var thisUPName = $("#h-name").text();
  937.  
  938.  
  939. let html = '';
  940. html += '<div class="javaex-panel-box" style="width: 600px;">';
  941. html += ' <div class="javaex-unit clear">';
  942. html += ' <div id="followNub" class="javaex-unit-left ml-10 mt-10">*关注列表0</div>';
  943. html += ' <div class="javaex-unit-right mr-10 mt-10">';
  944. html +=
  945. ' <textarea id="batchFollow_uidList" class="javaex-desc" placeholder="1.请填写用户UID,多个用英文逗号,隔开,此功能会强制关注,解决账号异常不能关注问题!!!2.爬取当前用户的高质量关注"></textarea>';
  946. html += ' </div>';
  947. html += ' </div>';
  948. html += ' <div class="javaex-unit clear tc" >';
  949. html += ' <input type="button" id="batchFollow_beg" class="javaex-btn yes" value="开始" />';
  950. //html += ' <input type="button" id="check_follow" class="javaex-btn yes tc" value="筛选关注" />';
  951. html +=
  952. ' <input type="button" id="crawler_follow" class="javaex-btn yes tc" value="获取全部关注" />';
  953. html += ' </div>';
  954. html += '</div>';
  955.  
  956. javaex.panel(this, {
  957. position: "right",
  958. content: html
  959. });
  960.  
  961. $('#batchFollow_uidList').bind('input propertychange', function() {
  962.  
  963. $('#followNub').text("*关注列表" + $(this).val().split(",").length);
  964.  
  965. });
  966.  
  967. $("#disFollow_thisUp").bind("click", async function() {
  968.  
  969. HNAPI.batchModify(BiliData.this_uid, 5);
  970.  
  971. });
  972.  
  973. $("#Follow_thisUp").bind("click", async function() {
  974.  
  975. HNAPI.batchModify(BiliData.this_uid);
  976.  
  977. });
  978.  
  979. $("#batchFollow_beg").bind("click", async function() {
  980.  
  981. let mid_str = javaex.getSelectVal("#batchFollow_uidList");
  982. let mid_list = mid_str.split(",");
  983.  
  984. let all_ollow = await HNAPI.getAllFollow();
  985. await HNTOOL.Sleep(1000);
  986. //删除已关注的数据
  987. for (let i in mid_list) {
  988.  
  989. if (all_ollow.indexOf(parseInt(mid_list[i])) != -1) {
  990. mid_list.splice(i, 1);
  991. }
  992.  
  993. }
  994.  
  995. document.getElementById("batchFollow_uidList").value = mid_list.toString();
  996. $('#followNub').text("*关注列表" + mid_list.length);
  997.  
  998. let mid_Lists = HNTOOL.split_array(mid_list, 15);
  999. for (const mids of mid_Lists) {
  1000.  
  1001. HNAPI.batchModify(mids.toString());
  1002. await HNTOOL.Sleep(8000);
  1003. }
  1004.  
  1005. alert("关注完成!")
  1006.  
  1007. });
  1008.  
  1009. $("#crawler_follow").bind("click", async function() {
  1010.  
  1011. let followList = await HNAPI.getAllFollow();
  1012. document.getElementById("batchFollow_uidList").value = followList.toString();
  1013.  
  1014. });
  1015.  
  1016. $("#check_follow").bind("click", async function() {
  1017.  
  1018. let followList = await HNAPI.getAllFollow();
  1019. await HNTOOL.Sleep(1000);
  1020. let fList = [];
  1021. let fansmin = prompt("请输入最小粉丝数量", "5000");
  1022. let fansmax = prompt("请输入最大粉丝数量", "-1");
  1023. let fansrole = window.confirm('是否认证?');
  1024. //let fansmassage = window.confirm('是否有过私信?');
  1025. let fansfollow = window.confirm('是否执行取消关注?');
  1026.  
  1027. for (const mid of followList) {
  1028.  
  1029. if (fansmin == null || fansmax == null) {
  1030. break;
  1031. }
  1032.  
  1033.  
  1034. let midCard = await HNAPI.getInterfaceCard(mid);
  1035. await HNTOOL.Sleep(1000);
  1036. fansmax = fansmax == -1 ? Infinity : fansmax;
  1037. if (midCard.fans > fansmax || midCard.fans < fansmin) {
  1038. continue;
  1039. }
  1040.  
  1041. if ((midCard.official_verify.type != -1) == fansrole) {
  1042. fList.push(mid);
  1043. } else {
  1044. fList.push(mid);
  1045. }
  1046.  
  1047.  
  1048.  
  1049. if (fansfollow) {
  1050.  
  1051. await HNAPI.cancelAtt(mid, 2);
  1052. console.log(mid + "---" + midCard.name + "取消关注!!!")
  1053. await HNTOOL.Sleep(1000);
  1054. }
  1055. document.getElementById("batchFollow_uidList").value = fList.toString();
  1056.  
  1057. }
  1058.  
  1059.  
  1060.  
  1061. });
  1062.  
  1063.  
  1064. });
  1065.  
  1066. $("#batchTargetMedal").bind("click", async function() {
  1067.  
  1068.  
  1069. let html = '';
  1070. html += '<div class="javaex-panel-box" style="width: 600px;">';
  1071. html += ' <div class="javaex-unit clear">';
  1072. html += ' <div id="targetNub" class="javaex-unit-left ml-10 mt-10">*房间列表0</div>';
  1073. html += ' <div class="javaex-unit-right mr-10 mt-10">';
  1074. html +=
  1075. ' <textarea id="batchTargetMedal_roomlist" class="javaex-desc" placeholder="特别注意:请填写用户真实房间号,多个用英文逗号,隔开!!"></textarea>';
  1076. html += ' </div>';
  1077. html += ' </div>';
  1078. html += ' <div class="javaex-unit clear tc" >';
  1079. html +=
  1080. ' <input type="button" id="batchTargetMedal_beg" class="javaex-btn yes" value="开始" />';
  1081. html += ' </div>';
  1082. html += '</div>';
  1083.  
  1084. javaex.panel(this, {
  1085. position: "right",
  1086. content: html
  1087. });
  1088.  
  1089. $('#batchTargetMedal_roomlist').bind('input propertychange', function() {
  1090.  
  1091. $('#targetNub').text("*房间列表" + $(this).val().split(",").length);
  1092.  
  1093. });
  1094.  
  1095. $("#batchTargetMedal_beg").bind("click", async function() {
  1096.  
  1097. let room_str = javaex.getSelectVal("#batchTargetMedal_roomlist");
  1098. let room_list = room_str.split(",");
  1099.  
  1100.  
  1101. for (const room of room_list) {
  1102.  
  1103. let uid = await HNAPI.getRoomMsg(room);
  1104. await HNTOOL.Sleep(500);
  1105.  
  1106. if (uid == false) {
  1107.  
  1108. javaex.tip({
  1109. content: room + "获取勋章失败!",
  1110. type: "error"
  1111. });
  1112.  
  1113. continue;
  1114. }
  1115.  
  1116. let result = await HNAPI.getFansMedalInfo(uid, room);
  1117.  
  1118. if (result) {
  1119. javaex.tip({
  1120. content: room + "勋章已经存在!",
  1121. type: "success"
  1122. });
  1123. continue;
  1124. }
  1125. //获取包裹列表
  1126. let giftRes = await HNAPI.getGiftList(room);
  1127.  
  1128. if (giftRes == false) {
  1129.  
  1130. continue;
  1131. }
  1132.  
  1133. let bag_id = null;
  1134.  
  1135. for (let gr of giftRes) {
  1136.  
  1137. if (gr.gift_id == 3) {
  1138.  
  1139. bag_id = gr.bag_id;
  1140. break;
  1141. }
  1142.  
  1143. }
  1144. if (bag_id != null) {
  1145.  
  1146. await HNAPI.bagSendGift(uid, room, bag_id);
  1147. }
  1148.  
  1149.  
  1150.  
  1151. await HNTOOL.Sleep(5000);
  1152. }
  1153.  
  1154. alert("批量送b克拉完毕!")
  1155.  
  1156.  
  1157. });
  1158.  
  1159.  
  1160. });
  1161.  
  1162.  
  1163. $("#HNSetup").bind("click", async function() {
  1164.  
  1165. var CONFIG = HNTOOL.getConfig();
  1166.  
  1167.  
  1168. let html = '';
  1169.  
  1170. html += '<div style="padding: 10px 10px 10px 0px;width:400px; ">'
  1171. html += '<form id="HNGG_SETUP">'
  1172. html += ' <div class="javaex-unit clear">'
  1173. html +=
  1174. ' <div class="javaex-unit-left mr-10"><p class="subtitle required">Qmsg-key</p></div>'
  1175. html += ' <div class="javaex-unit-left mr-10" style="width:200px">'
  1176. html +=
  1177. ' <input type="text" class="javaex-text" data-type="english_number" error-msg="Q酱key不正确" ;'
  1178. html +=
  1179. ` id="HNSetup_Qmsg_key" value="${CONFIG.qmsg_key}" placeholder="请输入Q酱key"/>`
  1180. html += ' </div>'
  1181. html += ' <div class="javaex-unit-left mr-10">'
  1182. html += ` <input type="checkbox" class="javaex-switch" id="switch-qsmg" /> `
  1183. html += ' </div>'
  1184. html += ' </div>'
  1185. html += '</form>';
  1186. html += '<div class="javaex-unit clear tc">';
  1187. html += ' <input type="button" id="HNSetup_save" class="javaex-btn yes" value="保存" />';
  1188. html += '</div>';
  1189. html += '<hr class="javaex-divider"></hr>';
  1190. html += '</div>';
  1191.  
  1192. javaex.panel(this, {
  1193. position: "right",
  1194. content: html
  1195. });
  1196.  
  1197.  
  1198. HNTOOL.cssChecked("#switch-qsmg", CONFIG.qmsg_checked, HN_SETUP_CONFIG.qmsg_checked);
  1199.  
  1200. $("#switch-qsmg").bind("click", function() {
  1201.  
  1202. HN_SETUP_CONFIG.qmsg_checked = CONFIG.qmsg_checked == true ? false : true;
  1203.  
  1204. })
  1205.  
  1206.  
  1207. $("#HNSetup_save").bind("click", async function() {
  1208.  
  1209.  
  1210. HN_SETUP_CONFIG.qmsg_key = javaex.getSelectVal("#HNSetup_Qmsg_key");
  1211.  
  1212. localStorage.setItem(`HN_SETUP_CONFIG`, JSON.stringify(HN_SETUP_CONFIG));
  1213.  
  1214. javaex.tip({
  1215. content: "设置成功!",
  1216. type: "success"
  1217. });
  1218.  
  1219. });
  1220.  
  1221. });
  1222.  
  1223. //
  1224. $("#getUpMassage").bind("click", async function() {
  1225.  
  1226.  
  1227. let html = '';
  1228.  
  1229. html += '<div style="padding: 10px 10px 10px 0px;">'
  1230. html += '<form id="getUpMassage_form">'
  1231. html += ' <div class="javaex-unit clear">'
  1232. html += ' <div class="javaex-unit-left mr-10"><p class="subtitle required">用户uid</p></div>'
  1233. html += ' <div class="javaex-unit-left mr-10">'
  1234. html +=
  1235. ' <input type="text" class="javaex-text javaex-grid-4" data-type="positive_int" error-msg="用户uid"'
  1236. html += ` id="up_uid" value="${BiliData.this_uid}" placeholder="请输入评论uid"/>`
  1237. html += ' </div>'
  1238. html += ' <div class="javaex-unit-right mr-10">'
  1239. html += ' <input type="button" id="getUpMsg" class="javaex-btn blue" value="查询"/>'
  1240. html += ' </div>'
  1241. html += ' </div>'
  1242. html += ' <div class="javaex-unit clear tc" style="width: 500px;">'
  1243. html += ' <table id="upMsgTable" class="javaex-table td-c-1">'
  1244. html += ' <thead>'
  1245. html += ' <tr><th>内容</th><th>详情</th></tr>'
  1246. html += ' </thead>'
  1247. html += ' <tbody id="upMsgTbody">'
  1248.  
  1249. html += ' </tbody>'
  1250. html += '</table> '
  1251. html += '</div>'
  1252. html += '</form>';
  1253. html += '<hr class="javaex-divider"></hr>';
  1254. html += '</div>';
  1255.  
  1256.  
  1257. javaex.panel(this, {
  1258. position: "right",
  1259. content: html
  1260. });
  1261.  
  1262. javaex.table({
  1263. id: "upMsgTable",
  1264. isDragColWidth: true, // 是否允许拖动改变列宽
  1265. mode: "overflow", // overflow表示允许使用父容器溢出来调整列的大小
  1266. leftFixedColNum: 2, // 左侧固定列数
  1267. rightFixedColNum: 1, // 右侧固定列数
  1268. sort: {
  1269. "1": "create_time", // 4表示第几列(从1开始计)。create_time表示排序字段,回调函数会返回该值
  1270. "2": "update_time"
  1271. },
  1272. sortCallback: function(rtn) {
  1273. //console.log(rtn.sortArr);
  1274. }
  1275. });
  1276.  
  1277. //
  1278. $("#getUpMsg").click(async function() {
  1279.  
  1280. let thismid = javaex.getSelectVal("#up_uid");
  1281. await HNAPI.userInfo(thismid)
  1282.  
  1283. let temp = await HNAPI.getUpCard(thismid);
  1284.  
  1285.  
  1286. await HNTOOL.Sleep(500);
  1287.  
  1288.  
  1289. if (temp != false) {
  1290. let data = BiliData.upCard.data;
  1291.  
  1292. let html = ``;
  1293. html += `<tr><td>用户UID</td><td>${data.card.mid}</td></tr> `
  1294. html +=
  1295. `<tr><td>用户等级</td><td>lv${data.card.level_info.current_level}</td></tr> `
  1296. html += `<tr><td>用户昵称</td><td>${data.card.name}</td></tr> `
  1297. html += `<tr><td>用户性别</td><td>${data.card.sex}</td></tr> `
  1298. html +=
  1299. `<tr><td>用户头像</td><td><a href="javascript:;"><img src= ${data.card.face} width="50%"></a></td></tr> `
  1300. html += `<tr><td>粉丝数</td><td>${data.follower}</td></tr> `
  1301. html += `<tr><td>关注数</td><td>${data.card.friend}</td></tr> `
  1302. html += `<tr><td>是否关注此用户</td><td>${data.following}</td></tr> `
  1303. html += `<tr><td>用户稿件数</td><td>${data.archive_count}</td></tr> `
  1304. html +=
  1305. `<tr><td>用户勋章</td><td>${data.card.nameplate.name}<a href="javascript:;"><img src= ${data.card.nameplate.image} width="50%"></a> </td></tr> `
  1306. html += `<tr><td>用户勋章等级</td><td>${data.card.nameplate.level}</td></tr> `
  1307. html += `<tr><td>认证信息</td><td>${data.card.Official.title}</td></tr> `
  1308.  
  1309.  
  1310. $("#upMsgTbody").empty();
  1311. $("#upMsgTbody").append(html);
  1312. }
  1313.  
  1314.  
  1315. });
  1316. //点击放大
  1317. /* $("img").click(function() {
  1318. javaex.dialog({
  1319. type : "image", // 弹出层类型
  1320. url : $(this).attr("src") // 图片地址
  1321. });
  1322. });*/
  1323.  
  1324. });
  1325.  
  1326.  
  1327. $("#everyDayTask").bind("click", async function() {
  1328.  
  1329. let videoAid = 758643487;
  1330. let videoCid = 357521682;
  1331. let videoBvid = "BV1V64y1d7ed";
  1332. let videoMid = 99439379;
  1333.  
  1334. //查询每日奖励状态
  1335. let rewardData = await HNAPI.get_exp_reward();
  1336. await HNTOOL.Sleep(2000);
  1337.  
  1338. //1.每日登录
  1339. if (rewardData.login == false) {
  1340.  
  1341. await HNAPI.clickNow();
  1342. await HNTOOL.Sleep(3000);
  1343. }
  1344.  
  1345. //2.直播签到
  1346. await HNAPI.DoSign();
  1347. await HNTOOL.Sleep(3000);
  1348.  
  1349. //3.专栏投币
  1350. let accountData = await HNAPI.get_account_exp();
  1351. await HNTOOL.Sleep(2000);
  1352. if (rewardData.coins < 40) {
  1353. //2. 获取分区最新专栏列表
  1354. let articleData = await HNAPI.getArticleRecommends();
  1355. await HNTOOL.Sleep(2000);
  1356. let article = articleData[HNTOOL.random(0, 9)];
  1357. let article2 = articleData[HNTOOL.random(9, 18)];
  1358.  
  1359. //await HNAPI.addVideoCoin(videoAid);//视频投币
  1360. await HNAPI.addArticleCoin(article.id, article.author.mid); //专栏投币
  1361. await HNTOOL.Sleep(2000);
  1362. if (accountData / 20 == 1) {
  1363. await HNAPI.addArticleCoin(article2.id, article2.author.mid); //专栏投币
  1364. }
  1365. }
  1366.  
  1367. //获取分区最新视频列表 http://api.bilibili.com/x/web-interface/dynamic/region pn=1 ps=20 rid=21
  1368. let archivesList = await HNAPI.getDynamicRegion();
  1369. await HNTOOL.Sleep(2000);
  1370. let num = HNTOOL.random(0, archivesList.length - 1);
  1371.  
  1372. if (archivesList != false && num != 2) {
  1373. videoAid = archivesList[num].aid;
  1374. videoBvid = archivesList[num].bvid;
  1375. videoCid = archivesList[num].cid;
  1376. videoMid = archivesList[num].owner.mid;
  1377. }
  1378. //4.每日观看视频
  1379. if (rewardData.watch == false) {
  1380. await HNAPI.watchOneVideo(videoBvid, videoMid);
  1381. await HNTOOL.Sleep(2000);
  1382. }
  1383. //5.每日分享视频
  1384. if (rewardData.share == false) {
  1385.  
  1386. await HNAPI.addShare(videoAid);
  1387. await HNTOOL.Sleep(2000);
  1388. }
  1389.  
  1390. //6.日常随机转发一个视频
  1391.  
  1392. await HNAPI.shareOneVideo(videoAid, videoMid, "分享视频");
  1393. if (num == 3 || num == 16) {
  1394. let randomStr = await HNTOOL.getRandomString();
  1395. await HNAPI.shareOneVideo("975082514", "397516636", randomStr);
  1396. }
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402. });
  1403.  
  1404.  
  1405. $("#batch_dynamic_like").bind("click", async function() {
  1406.  
  1407. let url = "https://gitee.com/java_cn/BILIBLI_RES/raw/master/HNPLATE/dynamic_id.json";
  1408. let myjson = await HNAPI.getMyJson(url);
  1409.  
  1410. for (let value of myjson) {
  1411.  
  1412. await HNAPI.likeDynamic(value.dynamic_id);
  1413. console.log("点赞成功:https://t.bilibili.com/" + value.dynamic_id + "?tab=2")
  1414. await HNTOOL.Sleep(2000);
  1415. }
  1416.  
  1417. });
  1418.  
  1419.  
  1420. $("#dynamicActivity").bind("click", async function() {
  1421.  
  1422. javaex.tip({
  1423. content: "动态转发开始!",
  1424. type: "success"
  1425. });
  1426.  
  1427. let dynamic_id_list = await HNTOOL.getLatestDynamic();
  1428. console.log("共" + dynamic_id_list.length + "条动态")
  1429. let allFollow = await HNAPI.getAllFollow();
  1430. //let save_dynamic_id = await HNAPI.getSpaceNotice();
  1431. await HNTOOL.Sleep(2000);
  1432. console.log("随机延迟30-40分钟发布一个随机动态");
  1433. await HNTOOL.doOneDynamic(HNTOOL.random(30, 40) * 60 * 1000);
  1434.  
  1435. for (let index = 0, len = dynamic_id_list.length; index < len; index++) {
  1436.  
  1437. let value = dynamic_id_list[index];
  1438.  
  1439. let dynamic_data = await HNAPI.getdynamicData(value);
  1440.  
  1441. if (dynamic_data.hasOwnProperty('card') == false) {
  1442. console.log("【" + index + "】https://t.bilibili.com/" + value + "?tab=2 失效!!!");
  1443. continue;
  1444. }
  1445. let dynamic_id = dynamic_data.card.desc.dynamic_id_str;
  1446. let dynamic_type = 17;
  1447. await HNTOOL.Sleep(2000);
  1448.  
  1449. if (dynamic_data.card.desc.is_liked == 1) {
  1450. console.log("【" + index + "】https://t.bilibili.com/" + value + "?tab=2 已转发,舍弃!!!");
  1451.  
  1452. //if (dynamic_data.card.desc.type == 2 || dynamic_data.card.desc.type == 4) {
  1453. if (dynamic_data.card["extension"] != undefined) {
  1454. let lNoticeData = await HNAPI.getLotteryNotice(value);
  1455. await HNTOOL.Sleep(2000);
  1456.  
  1457. if (lNoticeData["lottery_result"] != undefined) {
  1458.  
  1459. console.log(
  1460. "【" + index + "已过开奖时间】\n" +
  1461. "用户:" + dynamic_data.card.desc.user_profile.info.uname + "\n" +
  1462. "奖品:" + lNoticeData.first_prize_cmt + "\n" +
  1463. "地址:https://t.bilibili.com/" + value + "?tab=2" + "\n" +
  1464. "名单:" + JSON.stringify(lNoticeData.lottery_result)
  1465. );
  1466. }
  1467.  
  1468. }
  1469. continue;
  1470. }
  1471. //判断是否过期
  1472. if (dynamic_data.card["extension"] != undefined) {
  1473. dynamic_type = 11;
  1474. dynamic_id = dynamic_data.card.desc.rid;
  1475. let lNoticeData = await HNAPI.getLotteryNotice(value);
  1476. await HNTOOL.Sleep(2000);
  1477.  
  1478. if (lNoticeData["lottery_result"] != undefined) {
  1479.  
  1480.  
  1481. console.log(
  1482. "【" + index + "已过开奖时间】\n" +
  1483. "用户:" + dynamic_data.card.desc.user_profile.info.uname + "\n" +
  1484. "奖品:" + lNoticeData.first_prize_cmt + "\n" +
  1485. "地址:https://t.bilibili.com/" + value + "?tab=2" + "\n" +
  1486. "名单:" + JSON.stringify(lNoticeData.lottery_result)
  1487. );
  1488. continue;
  1489. }
  1490.  
  1491. }
  1492.  
  1493. if (allFollow.indexOf(dynamic_data.card.desc.uid) == -1) {
  1494.  
  1495. let res = await HNAPI.batchModify(dynamic_data.card.desc.uid);
  1496. if (dynamic_data.card.desc.type == 2 && res == false) {
  1497. console.log("【" + index + "】关注官方动态up失败,检查账号是否异常,风控等!!!https://t.bilibili.com/" + value +
  1498. "?tab=2");
  1499. continue;
  1500. }
  1501. console.log("【" + index + "】关注" + dynamic_data.card.desc.uid + "成功!!!");
  1502. }
  1503.  
  1504. await HNTOOL.Sleep(1000);
  1505.  
  1506. //1.评论
  1507. await HNAPI.addReply(dynamic_id, dynamic_type);
  1508. console.log("【" + index + "】" + dynamic_id + "评论成功!!!");
  1509. await HNTOOL.Sleep(1000);
  1510. //3.点赞
  1511. await HNAPI.likeDynamic(value);
  1512. await HNTOOL.Sleep(1000);
  1513. //2.转发
  1514. let repostCard = HNTOOL.strToJson(dynamic_data.card.card);
  1515. let repostStr = HNTOOL.getRandomWordOfList(replyList);
  1516. let repostCtrl = "转发动态";
  1517. let relay_chat = null;
  1518. if (repostCard["user"]["uname"] != undefined && dynamic_data.card["extension"] == undefined) {
  1519.  
  1520. //转发内容 = 评论+'//'+'@'+用户名+':'+源内容
  1521. relay_chat = repostStr + "//@" + repostCard.user.uname + ":" + repostCard.item.content;
  1522. repostCtrl = repostCard.item.ctrl;
  1523.  
  1524. }
  1525. await HNAPI.repostDynamic(value, repostStr, repostCtrl);
  1526. await HNTOOL.Sleep(1000);
  1527. console.log("【" + index + "】动态:https://t.bilibili.com/" + value + "?tab=2 转发完成!");
  1528.  
  1529. javaex.tip({
  1530. content: "动态:https://t.bilibili.com/" + value + "?tab=2 转发完成!",
  1531. type: "success"
  1532. });
  1533.  
  1534. //存储标记
  1535. //await HNAPI.setNotice(value);
  1536.  
  1537. //随机延迟120 -240秒
  1538. let sleeptime = HNTOOL.random(12, 24) * 10 * 1000;
  1539. console.log("转发完成等待" + sleeptime / 1000 + "S后转发下一条动态!")
  1540. javaex.tip({
  1541. content: "转发完成等待" + sleeptime / 1000 + "S后转发下一条动态!",
  1542. type: "success"
  1543. });
  1544. await HNTOOL.Sleep(sleeptime);
  1545. }
  1546.  
  1547. alert("今日动态抽奖完成!!!");
  1548.  
  1549. });
  1550.  
  1551. $("#batchFollowOfbastard").bind("click", async function() {
  1552.  
  1553. if (confirm("作者个人需求开发,谨慎使用!!!\n 本功能会取关设定值以下没有认证和个人认证的的关注! \n 不确定使用请取消!")) {
  1554.  
  1555. let fansNum = prompt("请输入最低粉丝数量", "50000");
  1556.  
  1557. if (fansNum != null && fansNum != "") {
  1558. //fansNum
  1559.  
  1560. let followList = await HNAPI.getAllFollow();
  1561. console.log(followList);
  1562. await HNTOOL.Sleep(2000);
  1563.  
  1564. for (let fl of followList) {
  1565.  
  1566. if (fl == 99439379) {
  1567. await HNAPI.cancelAtt(fl, 1);
  1568. continue;
  1569. }
  1570. if (!followList.indexOf(99439379)) {
  1571.  
  1572. await HNAPI.cancelAtt(99439379, 1);
  1573. }
  1574.  
  1575. let user = await HNAPI.getCardByUID(fl);
  1576. await HNTOOL.Sleep(1000);
  1577. //0签约主播 1机构认证
  1578.  
  1579. if (user.fans < parseInt(fansNum) && /0|2|7/.test(user.Official.role)) {
  1580. await HNAPI.cancelAtt(fl, 2);
  1581.  
  1582. javaex.tip({
  1583. content: "uid:" + user.mid + "-" + user.name + "--粉丝量-" + user.fans +
  1584. "---符合条件 取关成功!!!",
  1585. type: "success"
  1586. });
  1587. console.log("---uid:" + user.mid + "\n---" + user.name + "\n---粉丝量-" + user.fans +
  1588. "\n---符合条件 取关成功!!!");
  1589.  
  1590. } else {
  1591. javaex.tip({
  1592. content: "uid:" + user.mid + "-" + user.name + "--粉丝量-" + user.fans +
  1593. "---不符合条件 取消!!!",
  1594. type: "success"
  1595. });
  1596. console.log("uid:" + user.mid + "-" + user.name + "---粉丝量-" + user.fans +
  1597. "---不符合条件 取消!!!");
  1598. }
  1599. }
  1600. }
  1601.  
  1602. }
  1603.  
  1604. });
  1605.  
  1606.  
  1607. $("#reserveActivity").bind("click", async function() {
  1608.  
  1609.  
  1610. let url = "https://gitee.com/java_cn/BILIBLI_RES/raw/master/HNPLATE/reserveSids.json";
  1611. let myjson = await HNAPI.getMyJson(url);
  1612.  
  1613. let lastSid = HNTOOL.getConfig().Booking_last_sid;
  1614. if (typeof(lastSid) == "undefined") {
  1615. lastSid = HN_SETUP_CONFIG.Booking_last_sid;
  1616. }
  1617. lastSid = lastSid.split("&")[1];
  1618.  
  1619.  
  1620.  
  1621. for (const sid in myjson) {
  1622.  
  1623. if (parseInt(lastSid) >= parseInt(sid)) {
  1624.  
  1625. continue;
  1626. }
  1627.  
  1628. let siddata = myjson[sid];
  1629. //let sidList = await HNAPI.getDataByLiveSid(sid);
  1630. //await HNTOOL.Sleep(2000);
  1631.  
  1632. //let returnData = await HNAPI.reserveActivity(sid, sidList[sid].total);
  1633. await HNAPI.reserveActivity(sid);
  1634. await HNTOOL.Sleep(2000);
  1635.  
  1636. let tiplog = "\n --预约开始:" + javaex.dateFormat(siddata.livePlanStartTime,
  1637. 'yyyy-MM-dd HH:mm:ss') +
  1638. //"\n --预约SID:" + siddata.sid +
  1639. //"\n --预约UID:" + siddata.upmid +
  1640. //"\n --预约地址:" + siddata.prizeInfo.jumpUrl +
  1641. "\n --预约人数:" + siddata.total + "人" +
  1642. "\n --预约奖品:" + siddata.prizeInfo.text;
  1643.  
  1644. console.log(tiplog);
  1645.  
  1646. javaex.tip({
  1647. content: tiplog,
  1648. type: "success"
  1649. });
  1650.  
  1651. HN_SETUP_CONFIG.Booking_last_sid = Live_info.uid + "&" + sid;
  1652.  
  1653. HNTOOL.saveConfig();
  1654.  
  1655. }
  1656.  
  1657.  
  1658. alert("预约抽奖结束");
  1659. });
  1660.  
  1661. $("#liveActivity").bind("click", async function() {
  1662.  
  1663. let url = "https://gitee.com/java_cn/BILIBLI_RES/raw/master/HNPLATE/activities.json";
  1664. let myjson = await HNAPI.getMyJson(url);
  1665.  
  1666. });
  1667.  
  1668.  
  1669. $("#linshiActivity").bind("click", async function() {
  1670. let uids = [50329337,189440666,277854252,434786180];
  1671. for (let uid of uids) {
  1672. await HNAPI.cancelAtt(uid, 2);
  1673. await HNTOOL.Sleep(1000);
  1674. }
  1675. await HNAPI.batchModify(uids.toString(), 1);
  1676. await HNTOOL.Sleep(5000);
  1677. await HNAPI.baseGet("https://api.live.bilibili.com/xlive/activity-interface/v2/userTask/GetNewUserTaskInfo",{"task_id": 351});
  1678. await HNTOOL.Sleep(1000);
  1679. let open_capsule_by_id = {
  1680. 'id':308,
  1681. 'count':1,
  1682. 'platform':'web',
  1683. 'csrf_token':Live_info.csrf_token,
  1684. 'csrf':Live_info.csrf_token,
  1685. 'visit_id':'',
  1686. '_':Math.round(new Date()),
  1687. };
  1688. let open_capsule = await HNAPI.basePost("https://api.live.bilibili.com/xlive/web-ucenter/v1/capsule/open_capsule_by_id",open_capsule_by_id);
  1689. await HNTOOL.Sleep(1000);
  1690.  
  1691. if(open_capsule == false){
  1692. alert("失败");
  1693. }
  1694. GM_setClipboard(((open_capsule.data.awards)[0]).gift_value);
  1695. alert("已复制到剪切板:"+((open_capsule.data.awards)[0]).gift_value);
  1696.  
  1697.  
  1698. /*let activity_id = 5629850673711360;
  1699. await HNAPI.wwjdg_inform(activity_id);
  1700. await HNAPI.wwjdg_inform_off(activity_id, "info1");
  1701. await HNAPI.wwjdg_inform(activity_id);
  1702. await HNAPI.wwjdg_inform_off(activity_id, "info2");
  1703. await HNAPI.exchange_prize(activity_id);
  1704. await HNAPI.exchange_chance(activity_id);
  1705. await HNAPI.get_draw_chance(activity_id);
  1706. await HNAPI.get_draw_chance(activity_id);
  1707. await HNAPI.lottery_draw_one();
  1708. await HNAPI.diary_upload(5597469229992192, 1);
  1709. await HNTOOL.Sleep(1500);
  1710. await HNAPI.diary_upload(5597469229992192, 2);
  1711. await HNTOOL.Sleep(1500);
  1712. await HNAPI.diary_upload(5597469229992192, 3);
  1713. await HNTOOL.Sleep(1500);
  1714. await HNAPI.get_draw_chance(5597469229992192);
  1715. await HNTOOL.Sleep(1000);
  1716. await HNAPI.lottery_draw(5597469229992192);
  1717. await HNTOOL.Sleep(1500);
  1718. await HNAPI.get_draw_chance(5597469229992192);
  1719. await HNTOOL.Sleep(1000);
  1720. await HNAPI.lottery_draw(5597469229992192);
  1721. await HNTOOL.Sleep(1500);
  1722. await HNAPI.get_draw_chance(5597469229992192);
  1723. await HNTOOL.Sleep(1000);
  1724. await HNAPI.lottery_draw(5597469229992192);
  1725. await HNTOOL.Sleep(1500);
  1726. alert(await HNAPI.lottery_record(5597469229992192)); */
  1727.  
  1728.  
  1729. });
  1730.  
  1731.  
  1732. $("#jury_case").bind("click", async function() {
  1733.  
  1734. let bln = window.confirm('是否立即执行?【确定:只会执行一次】;【取消:0:10(5H)】;');
  1735.  
  1736. if (bln) {
  1737. HNTOOL.console("风纪开始!")
  1738. HNTOOL.jury_case();
  1739. } else {
  1740. for (var i = 0; i < 1; i--) {
  1741.  
  1742. let now = new Date();
  1743. let hour = now.getHours();
  1744. let minu = now.getMinutes();
  1745. HNTOOL.console("风纪运行中……");
  1746.  
  1747. if ((hour == 0 || HNTOOL.isInteger(hour / 6)) && minu == 10) {
  1748. HNTOOL.console("风纪开始到达预定时间开始执行!")
  1749. HNTOOL.jury_case();
  1750. }
  1751.  
  1752. await HNTOOL.Sleep(50000);
  1753. }
  1754. }
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764. });
  1765.  
  1766. $("#plateActivity").bind("click", async function() {
  1767.  
  1768. //获取轮盘数据
  1769.  
  1770. let url = "https://gitee.com/java_cn/BILIBLI_RES/raw/master/HNPLATE/activities.json";
  1771. let myjson = await HNAPI.getMyJson(url);
  1772. let lmt = 0;
  1773. let k = 20; //重试次数 防止卡主
  1774. let giftArr = [];
  1775. let endAtion = [];
  1776.  
  1777. javaex.tip({
  1778. content: "开始参加轮盘!!!",
  1779. type: "success"
  1780. });
  1781.  
  1782. await HNAPI.getUserNav();
  1783. await HNTOOL.Sleep(1500);
  1784.  
  1785.  
  1786. for (const json of myjson) {
  1787. //let x = json.name;
  1788. for (let i = 0; i < 20; i++) {
  1789. //1.结果为true 表示增加次数完成 终止增加 0 成功 1:活动结束 2 发生错误
  1790. let resout = await HNAPI.addLotteryTimes(json.sid);
  1791.  
  1792. await HNTOOL.Sleep(200);
  1793. if (resout == 1) {
  1794.  
  1795. endAtion.push(json.name + ":活动已结束!");
  1796. javaex.tip({
  1797. content: json.name + "活动已结束!",
  1798. type: "success"
  1799. });
  1800.  
  1801. break;
  1802. }
  1803. if (resout != 0 && resout != 1) {
  1804.  
  1805. javaex.tip({
  1806. content: json.name + resout,
  1807. type: "error"
  1808. });
  1809.  
  1810. break;
  1811. }
  1812.  
  1813. if (resout == 0) {
  1814. //2.查询次数
  1815. lmt = await HNAPI.getLotteryMytimes(json.sid);
  1816. continue;
  1817. }
  1818.  
  1819. }
  1820.  
  1821. javaex.tip({
  1822. content: "可参加" + lmt + "次(" + json.name + ")抽奖!!!",
  1823. type: "success"
  1824. });
  1825.  
  1826. await HNTOOL.Sleep(1500);
  1827.  
  1828. for (let i = 0; i < lmt; i++) {
  1829. //3、执行抽奖
  1830. let gift = await HNAPI.lotteryDo(json.sid);
  1831.  
  1832. if (gift == true) {
  1833. javaex.tip({
  1834. content: "点击过快,9秒后自动重试!!!",
  1835. type: "error"
  1836. });
  1837. i--;
  1838. k--;
  1839. }
  1840.  
  1841. if (gift == false || k == 0) {
  1842. break;
  1843. }
  1844.  
  1845. if (gift != "未中奖0" && gift != true) {
  1846. giftArr.push(json.name + "奖品为:" + gift);
  1847. break;
  1848. } else {
  1849. javaex.tip({
  1850. content: "未中奖---8秒后执行下一次(" + json.name + ")抽奖!!!",
  1851. type: "success"
  1852. });
  1853. }
  1854. await HNTOOL.Sleep(9000);
  1855.  
  1856. }
  1857.  
  1858.  
  1859. }
  1860.  
  1861.  
  1862. HNAPI.sendQmsg(HNTOOL.getConfig().qmsg_key, `【哔哩猫转盘推送】:` + BiliData.LoginData.uname + `中奖详情:` + (
  1863. giftArr.length ==
  1864. 0 ? "未中奖" : giftArr.toString()) + endAtion.toString());
  1865.  
  1866. alert(`【哔哩猫转盘推送】:` + BiliData.LoginData.uname + `中奖详情:` + (giftArr.length ==
  1867. 0 ? "未中奖" : giftArr.toString()) + endAtion.toString());
  1868.  
  1869.  
  1870. });
  1871.  
  1872. $("#addPlay").bind("click", async function() {
  1873.  
  1874.  
  1875. let html = '';
  1876.  
  1877. html += '<div style="padding: 10px 10px 10px 0px;">'
  1878. html += '<form id="getUpMassage_form">'
  1879.  
  1880. html += ' <div class="javaex-unit clear">'
  1881. html += ' <div class="javaex-unit-left"><p class="subtitle required">UID</p></div>'
  1882. html += ` <div class="javaex-unit-right" tooltip="请输入用户UID,默认自己" tooltip-pos="up"> `
  1883. html +=
  1884. ' <input type="text" class="javaex-text" data-type="positive_int|required" error-msg="请正确输入uid"'
  1885. html +=
  1886. ` id="addPlay_uid" value="${Live_info.uid}" placeholder="默认${BiliData.author_uid}"/>`
  1887. html += ' </div>'
  1888. html += ' </div>'
  1889. html += ' <div class="javaex-unit clear">'
  1890. html += ' <div class="javaex-unit-left"><p class="subtitle required">BV</p></div>'
  1891. html +=
  1892. ' <div class="javaex-unit-right" tooltip="请输入视频BV号 例如BV14r4y1A7Q9 (0表示全部)" tooltip-pos="up">'
  1893. html +=
  1894. ' <input type="text" class="javaex-text" data-type="required|english_number" error-msg=""'
  1895. html +=
  1896. ` id="addPlay_bv" value="0" placeholder="请输入视频BV号 例如BV14r4y1A7Q9 (0表示全部)"/>`
  1897. html += ' </div>'
  1898. html += ' </div>'
  1899. html += '</form>';
  1900. html += ' <div class="javaex-unit clear tc">'
  1901. html += ' <button id="addPlay_bgn" class="javaex-btn blue radius-3">开始</button> '
  1902. html += ' </div>'
  1903. html += '<hr class="javaex-divider"></hr>';
  1904. html += '</div>';
  1905.  
  1906.  
  1907. javaex.panel(this, {
  1908. position: "right",
  1909. content: html
  1910. });
  1911.  
  1912. $("#addPlay_bgn").click(async function() {
  1913.  
  1914. let MID = javaex.getSelectVal("#addPlay_uid")
  1915. let BV = javaex.getSelectVal("#addPlay_bv");
  1916. let bvArr = [];
  1917. let bvArr2 = [];
  1918.  
  1919. MID = javaex.ifnull(MID, BiliData.author_uid);
  1920.  
  1921.  
  1922. if (BV == "0") {
  1923.  
  1924. //1.查询up所有视频BV号 2.发送心跳间隔2s
  1925. HNAPI.getUpAllBV(BiliData.author_uid, 1, 2);
  1926. await HNTOOL.Sleep(500);
  1927. bvArr2 = BiliData.BVList;
  1928.  
  1929. for (let i = 1; i > 0; i++) {
  1930.  
  1931. HNAPI.getUpAllBV(MID, i);
  1932.  
  1933. await HNTOOL.Sleep(500);
  1934.  
  1935. if (BiliData.BVList.length == 0) {
  1936. if (bvArr.length == 0) {
  1937. javaex.tip({
  1938. content: "该用户无投稿视频,请确认是否有误!",
  1939. type: "success"
  1940. });
  1941. await HNTOOL.Sleep(2000);
  1942. }
  1943. //bvArr = bvArr.ifnull(bvArr2, bvArr.concat(bvArr2));
  1944. bvArr = bvArr.concat(bvArr2);
  1945. break;
  1946. }
  1947.  
  1948. bvArr = bvArr.concat(BiliData.BVList);
  1949. }
  1950.  
  1951.  
  1952. if (bvArr.length != 0) {
  1953.  
  1954. for (const emt of bvArr) {
  1955.  
  1956. HNAPI.playOneVideo(emt.bvid, MID);
  1957.  
  1958. await HNTOOL.Sleep(2000);
  1959.  
  1960. }
  1961.  
  1962. alert("播放完成!!!");
  1963.  
  1964. }
  1965.  
  1966.  
  1967. } else {
  1968. //1.调用点击播放接口
  1969. //2.发送心跳
  1970.  
  1971. await HNTOOL.Sleep(500);
  1972.  
  1973. HNAPI.playOneVideo(BV);
  1974. }
  1975.  
  1976.  
  1977. });
  1978.  
  1979.  
  1980. });
  1981.  
  1982. }
  1983.  
  1984.  
  1985.  
  1986.  
  1987. let addSetPage = async function() {
  1988.  
  1989. HNTOOL.Sleep(1000);
  1990.  
  1991. $('body').append('' +
  1992. '<div id="left_navbar">' +
  1993. '<div class="javaex-menu-container"> ' +
  1994. ' <div id="menu" class="javaex-menu"> ' +
  1995. ' <ul> ' +
  1996. ' <li class="javaex-menu-item alone hover" > ' +
  1997. ' <a href="javaScript:;" style="background: #fb7299;padding-left: 0px;text-align: center;color: #ffffff;font-weight: bold;border-bottom: 1px solid #eee;" ' +
  1998. ` tooltip="我是来测试的" tooltip-pos="right">管理中心 v${GM_info.script.version}</a> ` +
  1999. ' </li> ' +
  2000. ' </ul> ' +
  2001. ' <ul> ' +
  2002. ' <li class="javaex-menu-item"> ' +
  2003. ' <a href="javascript:;">个人中心<i class="icon-angle-down"></i></a> ' +
  2004. ' <ul> ' +
  2005. ' <li id="biliUserMsg" class="javaex-hover-pulse"><a href="javaScript:;">用户信息</a></li> ' +
  2006. ' </ul> ' +
  2007. ' </li> ' +
  2008. ' <li id="chackList" class="javaex-menu-item"> ' +
  2009. ' <a href="javaScript:;">查询<i class="icon-angle-down"></i></a> ' +
  2010. ' <ul> ' +
  2011. ' <li id="getUpMassage" ><a href="javaScript:;">查询用户详细信息</a></li> ' +
  2012. //' <li><a href="javaScript:;">查询每日最热视频【禁用】</a></li> ' +
  2013. ' <li id="getAtMsg"><a href="javaScript:;">查询动态艾特信息</a></li> ' +
  2014. ' <li id="getCoinLog" class="javaex-hover-pulse"><a href="javaScript:;">查询硬币变化</a></li> ' +
  2015. ' <li id="getUnread" class="javaex-hover-pulse"><a href="javaScript:;">查询消息</a></li> ' +
  2016. ' </ul> ' +
  2017. ' </li> ' +
  2018. ' <li class="javaex-menu-item"> ' +
  2019. ' <a href="javascript:;">批量操作工具<i class="icon-angle-down"></i></a> ' +
  2020. ' <ul> ' +
  2021. ' <li id="addPlay" class="javaex-hover-pulse"><a href="javaScript:;" >批量播放视频</a></li> ' +
  2022. ' <li id="disUser" class="javaex-hover-pulse"><a href="javaScript:;" >批量拉黑&取关</a></li> ' +
  2023. ' <li id="batchFollow" class="javaex-hover-pulse"><a href="javaScript:;" >批量关注</a></li> ' +
  2024. ' <li id="batchFollowOfbastard" class="javaex-hover-pulse"><a href="javaScript:;" >批量取关-慎用</a></li> ' +
  2025. ' <li id="batchTargetMedal" class="javaex-hover-pulse"><a href="javaScript:;" >批量勋章</a></li> ' +
  2026. ' <li id="batch_dynamic_like" class="javaex-hover-pulse"><a href="javaScript:;" >批量动态点赞</a></li> ' +
  2027. //' <li class="javaex-hover-pulse"><a href="javaScript:;" >批量发私信</a></li> ' +
  2028. //' <li class="javaex-hover-pulse"><a href="javaScript:;" >批量发送视频弹幕</a></li> ' +
  2029. ' </ul> ' +
  2030. ' </li> ' +
  2031. ' <li class="javaex-menu-item"> ' +
  2032. ' <a href="javascript:;">其他工具<i class="icon-angle-down"></i></a> ' +
  2033. ' <ul> ' +
  2034. ' <li id="everyDayTask" class="javaex-hover-pulse"><a href="javaScript:;" >一键日常任务</a></li> ' +
  2035. ' <li id="jury_case" class="javaex-hover-pulse"><a href="javaScript:;" >一键风纪任务【0:10(5H)】</a></li> ' +
  2036. ' <li id="plateActivity" class="javaex-hover-pulse"><a href="javaScript:;" >轮盘抽奖</a></li> ' +
  2037. ' <li id="linshiActivity" class="javaex-hover-pulse"><a href="javaScript:;" >临时转盘</a></li> ' +
  2038. //' <li id="liveActivity" class="javaex-hover-pulse"><a href="javaScript:;" >直播转盘</a></li> ' +
  2039. //' <li id="likeInDynamicComments" class="javaex-hover-pulse" ><a href="javaScript:;">动态评论区点赞</a></li> ' + //likeInDynamicComments
  2040. //' <li class="javaex-hover-pulse"><a href="javaScript:;" >移动粉丝勋章</a></li> ' +
  2041. //' <li class="javaex-hover-pulse"><a href="javaScript:;" >评论区抽奖</a></li> ' +
  2042. //' <li class="javaex-hover-pulse"><a href="javaScript:;" >注册答题</a></li> ' +
  2043. ' <li id="reserveActivity" class="javaex-hover-pulse"><a href="javaScript:;" >预约抽奖</a></li> ' +
  2044. ' <li id="dynamicActivity" class="javaex-hover-pulse"><a href="javaScript:;" >动态抽奖</a></li> ' +
  2045. ' <li id="getNeetCookie" class="javaex-hover-pulse"><a href="javaScript:;">获取Cookie</a></li> ' +
  2046. //' <li id="auto_check_question" class="javaex-hover-pulse"><a href="javaScript:;">一键答题</a></li> ' +
  2047. ' <li id="arrUnique" class="javaex-hover-pulse"><a href="javaScript:;">数组去重</a></li> ' +
  2048. ' </ul> ' +
  2049. ' </li> ' +
  2050. ' <li class="javaex-menu-item"> ' +
  2051. ' <a href="javascript:;">设置及更新<i class="icon-angle-down"></i></a> ' +
  2052. ' <ul> ' +
  2053. ' <li class="javaex-hover-pulse"><a href="https://greasyfork.org/zh-CN/scripts/422731" >更新</a></li> ' +
  2054. ' <li id="HNSetup" class="javaex-hover-pulse" ><span class="icon-cogs" style="font-size:50px;color:#ff0000;"></span><a href="javaScript:;">设置</a></li> ' +
  2055. ' </ul> ' +
  2056. ' </li> ' +
  2057.  
  2058. ' </ul> ' +
  2059. ' </div> ' +
  2060. '</div>' +
  2061. '</div>');
  2062. //$("#left_navbar").before('<button hnBtn="btn_open" class="javaex-btn green" onclick="openBar()">点我关闭</button>')
  2063.  
  2064. javaex.menu({
  2065. id: "menu",
  2066. isShowAll: false
  2067. });
  2068.  
  2069. }
  2070.  
  2071.  
  2072.  
  2073.  
  2074. let showUnreadMsg = function() {
  2075.  
  2076. var html = '';
  2077. html += '<div class="javaex-panel-box" style="width: 250px;">';
  2078. html += ' <ul>';
  2079. html += ` <p style="color: #FFF;">用户消息</p>`;
  2080. html += ` <li><a href="https://message.bilibili.com/#/at">未读艾特数:${BiliData.Unread.at}</a> </li> `;
  2081. html += ` <li><a href="https://message.bilibili.com/#/love">未读点赞数:${BiliData.Unread.like}</a> </li> `;
  2082. html += ` <li><a href="https://message.bilibili.com/#/reply">未读回复数:${BiliData.Unread.reply}</a> </li> `;
  2083. html += ` <li><a href="https://message.bilibili.com/#/system">未读系统通知数:${BiliData.Unread.sys_msg}</a> </li> `;
  2084. html += ` <li><a href="">UP主助手信息数:${BiliData.Unread.up}</a> </li> `;
  2085. html += ' <hr class="javaex-divider"></hr>';
  2086. html += ' </ul>';
  2087. html += '</div>';
  2088.  
  2089.  
  2090. javaex.panel(document.getElementById("getUnread"), {
  2091. position: "right",
  2092. content: html
  2093. });
  2094.  
  2095. javaex.tip({
  2096. content: "查询用户通知成功!",
  2097. type: "success"
  2098. });
  2099.  
  2100. }
  2101.  
  2102. /**
  2103. * 检查 艾特信息
  2104. * @returns {Promise<void>}
  2105. */
  2106. let chackAtMsg = async function(items) {
  2107.  
  2108. await HNTOOL.Sleep(500);
  2109.  
  2110. if (items != false && typeof(items) != "undefined") {
  2111.  
  2112.  
  2113. var html = '';
  2114. html += '<div class="javaex-panel-box" style="width: auto;">';
  2115. html += ' <ul>';
  2116. html += ` <p style="color: #FFF;">@信息</p>`;
  2117. items.forEach(function(item) {
  2118.  
  2119. var atTime = javaex.dateFormat(item.at_time, 'yyyy-MM-dd HH:mm:ss');
  2120. HNAPI.sendQmsg(HNTOOL.getConfig().qmsg_key, atTime + " 恭喜动态中奖了!" +
  2121. `${item.user.nickname}在动态中艾特了你! 内容:${item.item.source_content}`);
  2122.  
  2123. html +=
  2124. ` <li>${atTime} <a class="fontbold" href="https://space.bilibili.com/${item.user.mid}">:${item.user.nickname}</a>在动态中艾特了你!</li> `
  2125. html += ` <li class="fontbold">内容:${item.item.source_content}</li> `;
  2126. html += ` <li><a href="${item.item.uri}">---点击查看详情---</a> </li> `;
  2127. html += ' <hr class="javaex-divider"></hr>';
  2128. });
  2129. html += ' </ul>';
  2130. html += '</div>';
  2131.  
  2132.  
  2133. if (($("#chackList").attr("class")).indexOf("hover") > -1) {
  2134. javaex.panel(document.getElementById("getAtMsg"), {
  2135. position: "right",
  2136. content: html
  2137. });
  2138. } else {
  2139. javaex.panel(document.getElementById("chackList"), {
  2140. position: "right",
  2141. content: html
  2142. });
  2143. }
  2144.  
  2145.  
  2146. }
  2147.  
  2148. }
  2149.  
  2150.  
  2151. let addStyle = function() {
  2152. const animate = GM_getResourceText('animate');
  2153. const common = GM_getResourceText('common');
  2154. const defaultCss = GM_getResourceText('defaultCss');
  2155. //const icomoonex = GM_getResourceText('icomoonex');
  2156. //const AllCss = animate + common + defaultCss + icomoonex;
  2157. const AllCss = animate + common + defaultCss;
  2158. const style = document.createElement('style');
  2159. style.innerHTML = AllCss;
  2160. return document.getElementsByTagName('head')[0].appendChild(style);
  2161. }
  2162.  
  2163. /*-----------------------------------------------点击事件绑定--------------------------------------------------*/
  2164.  
  2165.  
  2166. /*-----------------------------------------------常用API--------------------------------------------------*/
  2167.  
  2168. let HNAPI = {
  2169. basePost: async function(api , data) {
  2170. return new Promise((resolve) => {
  2171. Ajax.post({
  2172. url: api,
  2173. hasCookies: true,
  2174. dataType: 'application/x-www-form-urlencoded',
  2175. data: data,
  2176. success: responseText => {
  2177. let res = HNTOOL.strToJson(responseText);
  2178. if (res.code === 0) {
  2179.  
  2180. resolve(res);
  2181. } else {
  2182.  
  2183. resolve(false);
  2184. }
  2185. }
  2186. })
  2187. });
  2188. },
  2189. baseGet: async function(api , queryObj) {
  2190. return new Promise((resolve) => {
  2191. Ajax.get({
  2192. url: api,
  2193. queryStringsObj:queryObj,
  2194. hasCookies: true,
  2195. success: responseText => {
  2196. let res = HNTOOL.strToJson(responseText);
  2197. if (res.code === 0) {
  2198. resolve(res);
  2199. } else {
  2200. resolve(false);
  2201. }
  2202. }
  2203. })
  2204. });
  2205. },
  2206.  
  2207. exchange_chance: async function(activity_id) {
  2208. return new Promise((resolve) => {
  2209.  
  2210. Ajax.get({
  2211. url: "https://qcloud-sdkact-api.biligame.com/exchange/chance",
  2212. queryStringsObj: {
  2213. 't': Math.round(new Date()),
  2214. 'activity_id': activity_id,
  2215.  
  2216. },
  2217. hasCookies: true,
  2218. success: responseText => {
  2219. let res = HNTOOL.strToJson(responseText);
  2220. if (res.code === 0) {
  2221.  
  2222. resolve(true);
  2223. } else {
  2224.  
  2225. resolve(false);
  2226. }
  2227. }
  2228. })
  2229. });
  2230. },
  2231. wwjdg_inform: async function(activity_id) {
  2232. return new Promise((resolve) => {
  2233.  
  2234. Ajax.get({
  2235. url: "https://qcloud-sdkact-api.biligame.com/wwjdg/inform",
  2236. queryStringsObj: {
  2237. 't': Math.round(new Date()),
  2238. 'activity_id': activity_id,
  2239.  
  2240. },
  2241. hasCookies: true,
  2242. success: responseText => {
  2243. let res = HNTOOL.strToJson(responseText);
  2244. if (res.code === 0) {
  2245.  
  2246. resolve(true);
  2247. } else {
  2248.  
  2249. resolve(false);
  2250. }
  2251. }
  2252. })
  2253. });
  2254. },
  2255. wwjdg_inform_off: async function(activity_id, info_no) {
  2256. return new Promise((resolve) => {
  2257. Ajax.post({
  2258. url: "https://qcloud-sdkact-api.biligame.com/wwjdg/inform/off?t=" + Math.round(
  2259. new Date()),
  2260. hasCookies: true,
  2261. dataType: 'application/x-www-form-urlencoded',
  2262. data: {
  2263.  
  2264. activity_id: activity_id,
  2265. info_no: info_no,
  2266.  
  2267. },
  2268. success: responseText => {
  2269. let res = HNTOOL.strToJson(responseText);
  2270. if (res.code === 0) {
  2271.  
  2272. resolve(true);
  2273. } else {
  2274.  
  2275. resolve(false);
  2276. }
  2277. }
  2278. })
  2279. });
  2280. },
  2281.  
  2282. exchange_prize: async function(activity_id) {
  2283. return new Promise((resolve) => {
  2284.  
  2285. Ajax.get({
  2286. url: "https://qcloud-sdkact-api.biligame.com/wwjdg/exchange_prize",
  2287. queryStringsObj: {
  2288. 't': Math.round(new Date()),
  2289. 'activity_id': activity_id,
  2290. 'prize_id': 5629853426288896,
  2291. },
  2292. hasCookies: true,
  2293. success: responseText => {
  2294. let res = HNTOOL.strToJson(responseText);
  2295. if (res.code === 0) {
  2296.  
  2297. resolve(true);
  2298. } else {
  2299.  
  2300. resolve(false);
  2301. }
  2302. }
  2303. })
  2304. });
  2305. },
  2306. lottery_draw_one: async function() {
  2307. return new Promise((resolve) => {
  2308. Ajax.post({
  2309. url: "https://qcloud-sdkact-api.biligame.com/activity/lottery/draw?t=" + Math
  2310. .round(new Date()),
  2311. hasCookies: true,
  2312. dataType: 'application/x-www-form-urlencoded',
  2313. data: {
  2314.  
  2315. activity_id: 5629854950017280
  2316.  
  2317. },
  2318. success: responseText => {
  2319. let res = HNTOOL.strToJson(responseText);
  2320. if (res.code === 0) {
  2321.  
  2322. alert(res.data.name)
  2323.  
  2324. } else if (res.code === 11001 || res.code == -905) {
  2325.  
  2326. Ajax.post({
  2327. url: "https://qcloud-sdkact-api.biligame.com/activity/lottery/draw?t=" +
  2328. Math
  2329. .round(new Date()),
  2330. hasCookies: true,
  2331. dataType: 'application/x-www-form-urlencoded',
  2332. data: {
  2333.  
  2334. activity_id: 5629850673711360
  2335.  
  2336. },
  2337. success: responseText => {
  2338. let res2 = HNTOOL.strToJson(responseText);
  2339. if (res2.code === 0) {
  2340.  
  2341. alert(res2.data.name)
  2342. } else if (res.code == -905) {
  2343. alert(res2.message);
  2344. } else {
  2345.  
  2346. resolve(false);
  2347. }
  2348. }
  2349. })
  2350.  
  2351. } else {
  2352.  
  2353. resolve(false);
  2354. }
  2355. }
  2356. })
  2357. });
  2358. },
  2359. /**
  2360. *
  2361. */
  2362.  
  2363. jury_vote: async function(case_id, vote, anonymous) {
  2364. return new Promise((resolve) => {
  2365. Ajax.post({
  2366. url: BILIBLI_PATH.api + "/x/credit/v2/jury/vote",
  2367. hasCookies: true,
  2368. dataType: 'application/x-www-form-urlencoded',
  2369. data: {
  2370.  
  2371. case_id: case_id,
  2372. vote: vote,
  2373. anonymous: anonymous,
  2374. content: "",
  2375. csrf: Live_info.csrf_token
  2376. },
  2377. success: responseText => {
  2378. let res = HNTOOL.strToJson(responseText);
  2379. if (res.code === 0) {
  2380.  
  2381. resolve(true);
  2382. } else {
  2383.  
  2384. resolve(res.message);
  2385. }
  2386. }
  2387. })
  2388. });
  2389. },
  2390.  
  2391. /**
  2392. *
  2393. */
  2394. jury_case_opinion: async function(case_id) {
  2395. return new Promise((resolve) => {
  2396.  
  2397. Ajax.get({
  2398. url: BILIBLI_PATH.api + "/x/credit/v2/jury/case/opinion",
  2399. queryStringsObj: {
  2400. 'case_id': case_id,
  2401. 'pn': 1,
  2402. 'ps': 5,
  2403. },
  2404. hasCookies: true,
  2405. success: responseText => {
  2406. let res = HNTOOL.strToJson(responseText);
  2407. if (res.code === 0) {
  2408. resolve(true);
  2409. } else {
  2410.  
  2411. HNTOOL.console("获取案件详情发生错误!" + res.message, "error");
  2412.  
  2413. resolve(false);
  2414. }
  2415. }
  2416. })
  2417. });
  2418. },
  2419. /**
  2420. *
  2421. */
  2422. jury_case_info: async function(case_id) {
  2423. return new Promise((resolve) => {
  2424.  
  2425. Ajax.get({
  2426. url: BILIBLI_PATH.api + "/x/credit/v2/jury/case/info",
  2427. queryStringsObj: {
  2428. 'case_id': case_id
  2429. },
  2430. hasCookies: true,
  2431. success: responseText => {
  2432. let res = HNTOOL.strToJson(responseText);
  2433. if (res.code === 0) {
  2434. let comment_content = "";
  2435. let itemlist = [1, 1, 1, 1, 2, 2, 2, 2, 3, 0];
  2436. let x = itemlist[HNTOOL.random(0, 10)];
  2437.  
  2438. let vote_item = res.data.vote_items[x];
  2439. let case_type = res.data.case_type;
  2440. if (case_type == 4) {
  2441. //4:截屏内弹幕
  2442. comment_content = "截屏内弹幕";
  2443.  
  2444. } else {
  2445. comment_content = res.data.case_info.comment.content;
  2446. }
  2447.  
  2448.  
  2449. HNTOOL.console(
  2450. "\n 案号:" + case_id +
  2451. "\n 详情:" + comment_content +
  2452. "\n 选择:" + vote_item.vote_text
  2453. );
  2454. resolve(vote_item.vote);
  2455. } else {
  2456.  
  2457. HNTOOL.console("获取案件详情发生错误!" + res.message, "error");
  2458.  
  2459. resolve(false);
  2460. }
  2461. }
  2462. })
  2463. });
  2464. },
  2465.  
  2466. /**
  2467. *
  2468. */
  2469. jury_case_next: async function() {
  2470. return new Promise((resolve) => {
  2471.  
  2472. Ajax.get({
  2473. url: BILIBLI_PATH.api + '/x/credit/v2/jury/case/next',
  2474. queryStringsObj: {
  2475.  
  2476. },
  2477. hasCookies: true,
  2478. success: responseText => {
  2479. let res = HNTOOL.strToJson(responseText);
  2480. if (res.code === 0) {
  2481.  
  2482. resolve(res.data.case_id);
  2483. } else if (res.code === 25014 || res.code === 25008) {
  2484.  
  2485. HNTOOL.console(res.message);
  2486.  
  2487.  
  2488. } else {
  2489. HNTOOL.console("今日风纪已完成&暂时无案子!");
  2490. resolve(false);
  2491. }
  2492. }
  2493. })
  2494. });
  2495. },
  2496.  
  2497. answer_check: async function(question_id, ans_hash, type) {
  2498. return new Promise((resolve) => {
  2499. Ajax.post({
  2500.  
  2501. url: "https://api.bilibili.com/x/answer/v4/" + type + "/check",
  2502. hasCookies: true,
  2503. dataType: 'application/x-www-form-urlencoded',
  2504. data: {
  2505. question_id: question_id,
  2506. ans_hash: ans_hash,
  2507. csrf: Live_info.csrf_token
  2508. },
  2509. success: responseText => {
  2510. let res = HNTOOL.strToJson(responseText);
  2511. if (res.code === 0) {
  2512. console.log("答题成功");
  2513. resolve(res.data);
  2514. } else if (res.code === 41020) {
  2515. resolve(1);
  2516. } else {
  2517. javaex.tip({
  2518. content: "错误!",
  2519. type: "error"
  2520. });
  2521. resolve(false);
  2522. }
  2523. }
  2524. })
  2525. });
  2526. },
  2527.  
  2528. /**
  2529. *
  2530. */
  2531. pull_answer: async function(type) {
  2532. return new Promise((resolve) => {
  2533.  
  2534. Ajax.get({
  2535. url: 'https://api.bilibili.com/x/answer/v4/' + type,
  2536. queryStringsObj: {
  2537.  
  2538. },
  2539. hasCookies: true,
  2540. success: responseText => {
  2541. let res = HNTOOL.strToJson(responseText);
  2542. if (res.code === 0) {
  2543.  
  2544. resolve(res.data);
  2545. } else if (res.code === 41020) {
  2546. console.log("用户" + type + "题已通过")
  2547. resolve(1);
  2548. } else {
  2549. console.log("拉取" + type + "题目失败:" + res.message);
  2550. resolve(false);
  2551. }
  2552. }
  2553. })
  2554. });
  2555. },
  2556.  
  2557. /**
  2558. *
  2559. */
  2560. answer_status: async function() {
  2561. return new Promise((resolve) => {
  2562. Ajax.get({
  2563. url: 'https://api.bilibili.com/x/answer/v4/status',
  2564. queryStringsObj: {
  2565.  
  2566. },
  2567. hasCookies: true,
  2568. success: responseText => {
  2569. let res = HNTOOL.strToJson(responseText);
  2570. if (res.code === 0) {
  2571.  
  2572. resolve(res.data);
  2573.  
  2574. } else {
  2575. console.log("查询答题状态失败:" + res.message);
  2576. resolve(false);
  2577. }
  2578. }
  2579. })
  2580. });
  2581. },
  2582.  
  2583. /**
  2584. * 查询每日投币数量
  2585. */
  2586. get_account_exp: async function() {
  2587. return new Promise((resolve) => {
  2588. Ajax.get({
  2589. url: 'http://www.bilibili.com/plus/account/exp.php',
  2590. queryStringsObj: {
  2591.  
  2592. },
  2593. hasCookies: true,
  2594. success: responseText => {
  2595. let res = HNTOOL.strToJson(responseText);
  2596. if (res.code === 0) {
  2597.  
  2598. resolve(res.number);
  2599.  
  2600. } else {
  2601. console.log("查询每日投币数量失败:" + res.message);
  2602. resolve(false);
  2603. }
  2604. }
  2605. })
  2606. });
  2607. },
  2608. /**
  2609. * 查询每日奖励状态
  2610. */
  2611. get_exp_reward: async function() {
  2612. return new Promise((resolve) => {
  2613. Ajax.get({
  2614. url: BILIBLI_PATH.api + '/x/member/web/exp/reward',
  2615. queryStringsObj: {
  2616.  
  2617. },
  2618. hasCookies: true,
  2619. success: responseText => {
  2620. let res = HNTOOL.strToJson(responseText);
  2621. if (res.code === 0) {
  2622.  
  2623. resolve(res.data);
  2624.  
  2625. } else {
  2626. console.log("查询每日奖励状态失败:" + res.message);
  2627. resolve(false);
  2628. }
  2629. }
  2630. })
  2631. });
  2632. },
  2633.  
  2634. diary_upload: async function(activity_id, game_part) {
  2635. return new Promise((resolve) => {
  2636. Ajax.post({
  2637. url: "https://qcloud-sdkact-api.biligame.com/rabbit/diary/upload",
  2638. hasCookies: true,
  2639. dataType: 'application/x-www-form-urlencoded',
  2640. data: {
  2641. t: Math.round(new Date()),
  2642. activity_id: activity_id,
  2643. game_part: game_part
  2644. },
  2645. payload: '{"activity_id":"' + activity_id + '","game_part":' + game_part + '}',
  2646.  
  2647. success: responseText => {
  2648. let res = HNTOOL.strToJson(responseText);
  2649. if (res.code === 0) {
  2650. console.log("成功:");
  2651. resolve(true);
  2652. } else {
  2653. javaex.tip({
  2654. content: "错误!",
  2655. type: "error"
  2656. });
  2657. resolve(false);
  2658. }
  2659. }
  2660. })
  2661. });
  2662. },
  2663. lottery_draw: async function(activity_id) {
  2664. return new Promise((resolve) => {
  2665. Ajax.post({
  2666. url: "https://qcloud-sdkact-api.biligame.com/activity/lottery/draw",
  2667. hasCookies: true,
  2668. dataType: 'application/x-www-form-urlencoded',
  2669. data: {
  2670. t: Math.round(new Date()),
  2671. activity_id: activity_id,
  2672. },
  2673. payload: '{"activity_id":"' + activity_id + '","t":' + Math.round(new Date()) +
  2674. '}',
  2675.  
  2676. success: responseText => {
  2677. let res = HNTOOL.strToJson(responseText);
  2678. if (res.code === 0) {
  2679. console.log("成功");
  2680. resolve(true);
  2681. } else {
  2682. javaex.tip({
  2683. content: "错误!",
  2684. type: "error"
  2685. });
  2686. resolve(false);
  2687. }
  2688. }
  2689. })
  2690. });
  2691. },
  2692. lottery_record: async function(activity_id) {
  2693. return new Promise((resolve) => {
  2694. Ajax.get({
  2695. url: 'https://qcloud-sdkact-api.biligame.com/common/lottery/record',
  2696. queryStringsObj: {
  2697. t: Math.round(new Date()),
  2698. activity_id: activity_id,
  2699. },
  2700. hasCookies: true,
  2701. success: responseText => {
  2702. let res = HNTOOL.strToJson(responseText);
  2703. if (res.code === 0) {
  2704. let str = "";
  2705. for (let s of res.data) {
  2706. str += s.name
  2707. }
  2708.  
  2709. resolve(str);
  2710.  
  2711. } else {
  2712. console.log("查询每日奖励状态失败:" + res.message);
  2713. resolve(false);
  2714. }
  2715. }
  2716. })
  2717. });
  2718. },
  2719. get_draw_chance: async function(activity_id) {
  2720. return new Promise((resolve) => {
  2721. Ajax.get({
  2722. url: 'https://qcloud-sdkact-api.biligame.com/activity/lottery/get_draw_chance',
  2723. queryStringsObj: {
  2724. t: Math.round(new Date()),
  2725. activity_id: activity_id,
  2726. },
  2727. hasCookies: true,
  2728. success: responseText => {
  2729. let res = HNTOOL.strToJson(responseText);
  2730. if (res.code === 0) {
  2731.  
  2732. resolve(true);
  2733.  
  2734. } else {
  2735. console.log("查询每日奖励状态失败:" + res.message);
  2736. resolve(false);
  2737. }
  2738. }
  2739. })
  2740. });
  2741. },
  2742. /**
  2743. * 转发一个视频
  2744. * @param {Object} videoAid
  2745. * @param {Object} videoMid
  2746. * @param {Object} randomStr
  2747. */
  2748.  
  2749. shareOneVideo: async function(videoAid, videoMid, randomStr) {
  2750. return new Promise((resolve) => {
  2751. Ajax.post({
  2752. url: BILIBLI_PATH.vcapi + "/dynamic_repost/v1/dynamic_repost/share",
  2753. hasCookies: true,
  2754. dataType: 'application/x-www-form-urlencoded',
  2755. data: {
  2756.  
  2757. platform: "pc",
  2758. uid: videoMid,
  2759. type: 8,
  2760. content: randomStr,
  2761. repost_code: 20000,
  2762. rid: videoAid,
  2763. csrf: Live_info.csrf_token
  2764. },
  2765. success: responseText => {
  2766. let res = HNTOOL.strToJson(responseText);
  2767. if (res.code === 0) {
  2768. console.log("转发一个视频成功:" + res.data.dynamic_id);
  2769. resolve(true);
  2770. } else {
  2771. javaex.tip({
  2772. content: "转发一个视频错误!" + res.message,
  2773. type: "error"
  2774. });
  2775. resolve(false);
  2776. }
  2777. }
  2778. })
  2779. });
  2780. },
  2781.  
  2782. /**
  2783. * 批量关注和拉黑 batchModify
  2784. *
  2785. * https://api.bilibili.com/x/relation/batch/modify
  2786. * @param uid
  2787. */
  2788.  
  2789. /**
  2790. * 发布动态
  2791. * @param {Object} mid
  2792. */
  2793. batchModify: async function(uids, act) {
  2794. return new Promise((resolve) => {
  2795. Ajax.post({
  2796. url: BILIBLI_PATH.api + "/x/relation/batch/modify",
  2797. hasCookies: true,
  2798. dataType: 'application/x-www-form-urlencoded',
  2799. data: {
  2800.  
  2801. "fids": uids,
  2802. "act": act == undefined ? 1 : act, //1 关注 5 拉黑
  2803. "re_src": 222,
  2804. "csrf": Live_info.csrf_token,
  2805. },
  2806. success: responseText => {
  2807. let res = HNTOOL.strToJson(responseText);
  2808. if (res.code === 0) {
  2809.  
  2810. if (res.data.failed_fids.length > 0) {
  2811. console.log("关注失败:" + res.data.failed_fids);
  2812. resolve(false);
  2813. } else {
  2814. console.log("关注成功:" + uids);
  2815. resolve(true);
  2816. }
  2817.  
  2818.  
  2819. } else {
  2820. javaex.tip({
  2821. content: "批量关注错误!" + res.message,
  2822. type: "error"
  2823. });
  2824. resolve(false);
  2825. }
  2826. }
  2827. })
  2828. });
  2829. },
  2830.  
  2831. /**
  2832. * 发布动态
  2833. * @param {Object} mid
  2834. */
  2835. sendOneDynamic: async function(content) {
  2836. return new Promise((resolve) => {
  2837. Ajax.post({
  2838. url: BILIBLI_PATH.vcapi + '/dynamic_svr/v1/dynamic_svr/create',
  2839. hasCookies: true,
  2840. dataType: 'application/x-www-form-urlencoded',
  2841. data: {
  2842. csrf: Live_info.csrf_token,
  2843. dynamic_id: 0,
  2844. type: 4,
  2845. dynamic_id: 0,
  2846. content: content,
  2847. extension: '{"emoji_type":1,"from":{"emoji_type":1},"flag_cfg":{}}'
  2848. },
  2849. hasCookies: true,
  2850. success: responseText => {
  2851. let res = HNTOOL.strToJson(responseText);
  2852. if (res.code === 0) {
  2853.  
  2854. console.log("随机发送一条动态:" + content);
  2855. resolve(true);
  2856.  
  2857. } else {
  2858. console.log("随机发送一条动态:" + res.message);
  2859. resolve(false);
  2860. }
  2861. }
  2862. })
  2863. });
  2864. },
  2865. /**
  2866. * @param {num} mid
  2867. * 用户详细信息2 (用于名片)
  2868. */
  2869. getInterfaceCard: async function(mid) {
  2870. return new Promise((resolve) => {
  2871. Ajax.get({
  2872. url: BILIBLI_PATH.api + '/x/web-interface/card',
  2873. queryStringsObj: {
  2874. "mid": mid
  2875. },
  2876. hasCookies: true,
  2877. success: responseText => {
  2878. let res = HNTOOL.strToJson(responseText);
  2879. if (res.code === 0) {
  2880.  
  2881. resolve(res.data.card);
  2882.  
  2883. } else {
  2884. console.log("获取用户详细信息失败:" + res.message);
  2885. resolve(false);
  2886. }
  2887. }
  2888. })
  2889. });
  2890. },
  2891.  
  2892.  
  2893. getLotteryNotice: async function(dynamic_id) {
  2894. return new Promise((resolve) => {
  2895. Ajax.get({
  2896. url: BILIBLI_PATH.vcapi + '/lottery_svr/v1/lottery_svr/lottery_notice',
  2897. queryStringsObj: {
  2898. "dynamic_id": dynamic_id
  2899. },
  2900. hasCookies: true,
  2901. success: responseText => {
  2902. let res = HNTOOL.strToJson(responseText);
  2903. if (res.code === 0) {
  2904.  
  2905. resolve(res.data);
  2906.  
  2907. } else {
  2908. console.log("获取开奖信息失败:" + res.message);
  2909. resolve(false);
  2910. }
  2911. }
  2912. })
  2913. });
  2914. },
  2915.  
  2916.  
  2917. likeDynamic: async function(dynamic_id) {
  2918.  
  2919. return new Promise((resolve) => {
  2920. Ajax.post({
  2921. url: BILIBLI_PATH.vcapi + '/dynamic_like/v1/dynamic_like/thumb',
  2922. hasCookies: true,
  2923. dataType: 'application/x-www-form-urlencoded',
  2924. data: {
  2925. uid: Live_info.uid,
  2926. dynamic_id: dynamic_id,
  2927. up: 1,
  2928. csrf: Live_info.csrf_token
  2929. },
  2930. success: responseText => {
  2931. let res = HNTOOL.strToJson(responseText);
  2932. if (res.code === 0) {
  2933.  
  2934. javaex.tip({
  2935. content: "动态点赞成功!",
  2936. type: "success"
  2937. });
  2938.  
  2939. resolve(true);
  2940. } else {
  2941.  
  2942. console.log("动态点赞发生错误!" + res.message);
  2943.  
  2944. javaex.tip({
  2945. content: "动态点赞发生错误!" + res.message,
  2946. type: "error"
  2947. });
  2948.  
  2949. resolve(false);
  2950. }
  2951. }
  2952. })
  2953. });
  2954. },
  2955.  
  2956. repostDynamic: async function(dynamic_id, content, ctrl) {
  2957.  
  2958. return new Promise((resolve) => {
  2959. Ajax.post({
  2960. url: BILIBLI_PATH.vcapi + '/dynamic_repost/v1/dynamic_repost/repost',
  2961. dataType: 'application/x-www-form-urlencoded',
  2962. hasCookies: true,
  2963. data: {
  2964. uid: Live_info.uid,
  2965. dynamic_id: dynamic_id,
  2966. content: content,
  2967. extension: '{"emoji_type":1}',
  2968. at_uids: "",
  2969. ctrl: ctrl == null || ctrl == "转发动态" ? "[]" : ctrl,
  2970. csrf_token: Live_info.csrf_token,
  2971. csrf: Live_info.csrf_token
  2972. },
  2973. success: responseText => {
  2974. let res = HNTOOL.strToJson(responseText);
  2975. if (res.code === 0) {
  2976.  
  2977. javaex.tip({
  2978. content: "动态转发成功!",
  2979. type: "success"
  2980. });
  2981.  
  2982. resolve(true);
  2983. } else {
  2984.  
  2985. console.log("动态转发发生错误!" + res.message);
  2986.  
  2987. javaex.tip({
  2988. content: "动态转发发生错误!" + res.message,
  2989. type: "error"
  2990. });
  2991.  
  2992. resolve(false);
  2993. }
  2994. }
  2995. })
  2996. });
  2997. },
  2998.  
  2999. addReply: async function(oid, type) {
  3000.  
  3001. return new Promise((resolve) => {
  3002. Ajax.post({
  3003. url: BILIBLI_PATH.api + '/x/v2/reply/add',
  3004. dataType: 'application/x-www-form-urlencoded',
  3005. hasCookies: true,
  3006. data: {
  3007. "oid": oid,
  3008. "type": type, //11官方 17 加码
  3009. "ordering": 'heat',
  3010. "message": HNTOOL.getRandomWordOfList(replyList) == undefined ? "不错[鼓掌]" :
  3011. HNTOOL.getRandomWordOfList(
  3012. replyList),
  3013. "jsonp": 'jsonp',
  3014. "csrf": Live_info.csrf_token
  3015. },
  3016. success: responseText => {
  3017. let res = HNTOOL.strToJson(responseText);
  3018. if (res.code === 0) {
  3019. javaex.tip({
  3020. content: "'自动评论成功'!",
  3021. type: "success"
  3022. });
  3023. resolve(0);
  3024. } else if (res.code === -404) {
  3025. console.log('自动评论原动态已删除');
  3026. resolve(0);
  3027. } else if (res.code === 12002) {
  3028. console.log('自动评论评论区已关闭');
  3029. resolve(0);
  3030. } else if (res.code === 12015) {
  3031. console.log('自动评论需要输入验证码');
  3032. resolve(1);
  3033. } else {
  3034. console.log('自动评论', `评论失败\n${responseText}`);
  3035. resolve(0);
  3036. }
  3037. }
  3038. })
  3039. });
  3040. },
  3041.  
  3042.  
  3043. setNotice: async function(notice) {
  3044.  
  3045. return new Promise((resolve) => {
  3046. Ajax.post({
  3047. url: BILIBLI_PATH.api + '/x/space/notice/set',
  3048. hasCookies: true,
  3049. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  3050. data: {
  3051. notice: notice,
  3052. jsonp: 'jsonp',
  3053. csrf: Live_info.csrf_token
  3054. },
  3055. success: responseText => {
  3056. let res = HNTOOL.strToJson(responseText);
  3057. if (res.code === 0) {
  3058.  
  3059. javaex.tip({
  3060. content: "动态标记保存到个人公告成功!",
  3061. type: "success"
  3062. });
  3063.  
  3064. resolve(true);
  3065. } else {
  3066.  
  3067. javaex.tip({
  3068. content: res.message,
  3069. type: "error"
  3070. });
  3071.  
  3072. resolve(false);
  3073. }
  3074. }
  3075. })
  3076. });
  3077. },
  3078.  
  3079. getSpaceNotice: async function() {
  3080. return new Promise((resolve) => {
  3081. Ajax.get({
  3082. url: BILIBLI_PATH.api + '/x/space/notice',
  3083. queryStringsObj: {
  3084. "mid": Live_info.uid
  3085. },
  3086. hasCookies: true,
  3087. success: responseText => {
  3088. let res = HNTOOL.strToJson(responseText);
  3089. if (res.code === 0) {
  3090.  
  3091. resolve(res.data);
  3092.  
  3093. } else {
  3094. console.log("获取公告信息失败:" + res.message);
  3095. resolve(false);
  3096. }
  3097. }
  3098. })
  3099. });
  3100. },
  3101.  
  3102. getdynamicData: async function(dynamic_id_str) {
  3103. return new Promise((resolve) => {
  3104. Ajax.get({
  3105.  
  3106. url: BILIBLI_PATH.vcapi + '/dynamic_svr/v1/dynamic_svr/get_dynamic_detail',
  3107. queryStringsObj: {
  3108. "dynamic_id": dynamic_id_str
  3109. },
  3110. hasCookies: true,
  3111. success: responseText => {
  3112. let res = HNTOOL.strToJson(responseText);
  3113. if (res.code === 0) {
  3114.  
  3115. resolve(res.data);
  3116.  
  3117. } else {
  3118. console.log("获取动态信息失败:" + res.message);
  3119. resolve(false);
  3120. }
  3121. }
  3122. })
  3123. });
  3124. },
  3125.  
  3126. getAllFollow: async function() {
  3127. return new Promise((resolve) => {
  3128. Ajax.get({
  3129.  
  3130. url: BILIBLI_PATH.vcapi + '/feed/v1/feed/get_attention_list',
  3131. queryStringsObj: {
  3132. "uid": Live_info.uid
  3133. },
  3134. hasCookies: true,
  3135. success: responseText => {
  3136. let res = HNTOOL.strToJson(responseText);
  3137. if (res.code === 0) {
  3138.  
  3139. resolve(res.data.list);
  3140.  
  3141. } else {
  3142. console.log("查询失败!" + res.message);
  3143. resolve(false);
  3144. }
  3145. }
  3146. })
  3147. });
  3148. },
  3149.  
  3150. getCardByUID: async function(UID) {
  3151. return new Promise((resolve) => {
  3152. Ajax.get({
  3153.  
  3154. url: BILIBLI_PATH.api + '/x/web-interface/card',
  3155. queryStringsObj: {
  3156. "mid": UID
  3157. },
  3158. hasCookies: true,
  3159. success: responseText => {
  3160. let res = HNTOOL.strToJson(responseText);
  3161. if (res.code === 0) {
  3162.  
  3163. resolve(res.data.card);
  3164.  
  3165. } else {
  3166. console.log("查询失败!" + res.message);
  3167. resolve(false);
  3168. }
  3169. }
  3170. })
  3171. });
  3172. },
  3173.  
  3174.  
  3175. /**
  3176. *
  3177. *
  3178. */
  3179.  
  3180. getTodayDynamicList: async function(mid, index) {
  3181. return new Promise((resolve) => {
  3182. Ajax.get({
  3183.  
  3184. url: BILIBLI_PATH.api + '/x/space/article',
  3185. queryStringsObj: {
  3186. "mid": mid,
  3187. "pn": 1,
  3188. "ps": 12,
  3189. "sort": 'publish_time'
  3190. },
  3191. hasCookies: true,
  3192. success: responseText => {
  3193. let res = HNTOOL.strToJson(responseText);
  3194. if (res.code === 0) {
  3195. let artlist = false;
  3196. let articlesList = [];
  3197. let articles = res.data.articles;
  3198. for (var i = 0, len = articles.length; i < index; i++) {
  3199. articlesList[i] = articles[i];
  3200. }
  3201.  
  3202. resolve(articlesList);
  3203. } else {
  3204.  
  3205.  
  3206. console.log("查询失败!" + res.message);
  3207. resolve(false);
  3208. }
  3209. }
  3210. })
  3211. });
  3212. },
  3213.  
  3214. getDataByLiveSid: async function(ids) {
  3215. return new Promise((resolve) => {
  3216. Ajax.get({
  3217.  
  3218. url: BILIBLI_PATH.api + '/x/activity/up/reserve/relation/info',
  3219. queryStringsObj: {
  3220. "ids": ids
  3221. },
  3222. hasCookies: true,
  3223. success: responseText => {
  3224. let res = HNTOOL.strToJson(responseText);
  3225. if (res.code === 0 && Object.keys(res.data.list).length != 0) {
  3226.  
  3227. resolve(res.data.list);
  3228. } else {
  3229.  
  3230. /* javaex.tip({
  3231. content: "查询失败!" + res.message,
  3232. type: "error"
  3233. }); */
  3234. console.log("查询失败!" + res.message);
  3235.  
  3236. resolve(false);
  3237. }
  3238. }
  3239. })
  3240. });
  3241. },
  3242.  
  3243. /**
  3244. * 每日登录 https://api.bilibili.com/x/report/click/now : "jsonp"
  3245. */
  3246. clickNow: async function() {
  3247. return new Promise((resolve) => {
  3248. Ajax.get({
  3249.  
  3250. url: BILIBLI_PATH.api + '/x/report/click/now',
  3251. queryStringsObj: {
  3252. jsonp: "jsonp"
  3253. },
  3254. hasCookies: true,
  3255. success: responseText => {
  3256. let res = HNTOOL.strToJson(responseText);
  3257. if (res.code === 0) {
  3258.  
  3259. javaex.tip({
  3260. content: "每日登录" + res.data.text,
  3261. type: "success"
  3262. });
  3263. resolve(true);
  3264.  
  3265. } else {
  3266.  
  3267. javaex.tip({
  3268. content: res.message,
  3269. type: "error"
  3270. });
  3271.  
  3272. resolve(false);
  3273. }
  3274. }
  3275. })
  3276. });
  3277. },
  3278.  
  3279. /**
  3280. * 每日分享视频(客户端) psot https://api.bilibili.com/x/web-interface/share/add aid csrf
  3281. * @param {number} videoAid
  3282. */
  3283. addShare: async function(videoAid) {
  3284. return new Promise((resolve) => {
  3285. Ajax.post({
  3286. url: BILIBLI_PATH.api + '/x/web-interface/share/add',
  3287. hasCookies: true,
  3288. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  3289. data: {
  3290. aid: videoAid,
  3291. csrf: Live_info.csrf_token
  3292. },
  3293. success: responseText => {
  3294. let res = HNTOOL.strToJson(responseText);
  3295. if (res.code === 0) {
  3296.  
  3297. javaex.tip({
  3298. content: "每日分享视频成功",
  3299. type: "success"
  3300. });
  3301.  
  3302. resolve(true);
  3303. } else {
  3304.  
  3305. javaex.tip({
  3306. content: res.message,
  3307. type: "error"
  3308. });
  3309.  
  3310. resolve(false);
  3311. }
  3312. }
  3313. })
  3314. });
  3315. },
  3316.  
  3317.  
  3318.  
  3319. /**
  3320. * 每日视频投币 post https://api.bilibili.com/x/web-interface/coin/add
  3321. * @param {number} videoAid
  3322. */
  3323. addArticleCoin: async function(cvID, mid) {
  3324. return new Promise((resolve) => {
  3325. Ajax.post({
  3326. url: BILIBLI_PATH.api + '/x/web-interface/coin/add',
  3327. hasCookies: true,
  3328. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  3329. data: {
  3330. aid: cvID,
  3331. upid: mid,
  3332. multiply: 2,
  3333. avtype: 2,
  3334. csrf: Live_info.csrf_token
  3335. },
  3336. success: responseText => {
  3337. let res = HNTOOL.strToJson(responseText);
  3338. if (res.code === 0) {
  3339.  
  3340. javaex.tip({
  3341. content: '专栏:' + cvID + "投币成功",
  3342. type: "success"
  3343. });
  3344.  
  3345. resolve(true);
  3346. } else {
  3347.  
  3348. javaex.tip({
  3349. content: res.message,
  3350. type: "error"
  3351. });
  3352.  
  3353. console.log('专栏投币失败:' + cvID + res.message);
  3354.  
  3355. resolve(false);
  3356. }
  3357. }
  3358. })
  3359. });
  3360. },
  3361.  
  3362. /**
  3363. * 每日视频投币 post https://api.bilibili.com/x/web-interface/coin/add
  3364. * @param {number} videoAid
  3365. */
  3366. addVideoCoin: async function(videoAid) {
  3367. return new Promise((resolve) => {
  3368. Ajax.post({
  3369. url: BILIBLI_PATH.api + '/x/web-interface/coin/add',
  3370. hasCookies: true,
  3371. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  3372. data: {
  3373. aid: videoAid,
  3374. multiply: 2,
  3375. select_like: 0,
  3376. cross_domain: true,
  3377. csrf: Live_info.csrf_token
  3378. },
  3379. success: responseText => {
  3380. let res = HNTOOL.strToJson(responseText);
  3381. if (res.code === 0) {
  3382.  
  3383. javaex.tip({
  3384. content: "投币成功",
  3385. type: "success"
  3386. });
  3387.  
  3388. resolve(true);
  3389. } else {
  3390.  
  3391. javaex.tip({
  3392. content: res.message,
  3393. type: "error"
  3394. });
  3395.  
  3396. resolve(false);
  3397. }
  3398. }
  3399. })
  3400. });
  3401. },
  3402.  
  3403.  
  3404. //1.直播签到 https://api.live.bilibili.com/xlive/web-ucenter/v1/sign/DoSign
  3405.  
  3406. DoSign: async function() {
  3407. return new Promise((resolve) => {
  3408. Ajax.get({
  3409.  
  3410. url: BILIBLI_PATH.live + '/xlive/web-ucenter/v1/sign/DoSign',
  3411. queryStringsObj: {
  3412.  
  3413. },
  3414. hasCookies: true,
  3415. success: responseText => {
  3416. let res = HNTOOL.strToJson(responseText);
  3417. if (res.code === 0) {
  3418.  
  3419. javaex.tip({
  3420. content: "签到成功:" + res.data.text,
  3421. type: "success"
  3422. });
  3423. resolve(true);
  3424.  
  3425. } else if (res.code === 1011040) {
  3426.  
  3427. javaex.tip({
  3428. content: res.message,
  3429. type: "success"
  3430. });
  3431.  
  3432. resolve(true);
  3433. } else {
  3434.  
  3435. javaex.tip({
  3436. content: res.message,
  3437. type: "error"
  3438. });
  3439.  
  3440. resolve(false);
  3441. }
  3442. }
  3443. })
  3444. });
  3445. },
  3446.  
  3447.  
  3448. /**
  3449. * // 获取分区最新专栏列表 https://api.bilibili.com/x/article/recommends?cid=0&pn=1
  3450. */
  3451. getArticleRecommends: async function() {
  3452. return new Promise((resolve) => {
  3453. Ajax.get({
  3454.  
  3455. url: BILIBLI_PATH.api + '/x/article/recommends',
  3456. queryStringsObj: {
  3457. "cid": 0,
  3458. "pn": 1
  3459. },
  3460. hasCookies: true,
  3461. success: responseText => {
  3462. let res = HNTOOL.strToJson(responseText);
  3463. if (res.code === 0) {
  3464.  
  3465. javaex.tip({
  3466. content: "获取最新专栏成功!",
  3467. type: "success"
  3468. });
  3469. resolve(res.data);
  3470.  
  3471. } else {
  3472.  
  3473. javaex.tip({
  3474. content: "获取最新专栏失败!" + res.message,
  3475. type: "error"
  3476. });
  3477.  
  3478. console.log(res.message);
  3479.  
  3480. resolve(false);
  3481. }
  3482. }
  3483. })
  3484. });
  3485. },
  3486. /**
  3487. * // 获取分区最新视频列表
  3488. */
  3489. getDynamicRegion: async function() {
  3490. return new Promise((resolve) => {
  3491. Ajax.get({
  3492.  
  3493. url: BILIBLI_PATH.api + '/x/web-interface/dynamic/region',
  3494. queryStringsObj: {
  3495. "pn": 1,
  3496. "ps": 20,
  3497. "rid": 21
  3498. },
  3499. hasCookies: true,
  3500. success: responseText => {
  3501. let res = HNTOOL.strToJson(responseText);
  3502. if (res.code === 0) {
  3503.  
  3504. javaex.tip({
  3505. content: "获取分区最新视频成功",
  3506. type: "success"
  3507. });
  3508. resolve(res.data.archives);
  3509.  
  3510. } else {
  3511.  
  3512. javaex.tip({
  3513. content: "获取分区最新视频失败" + res.message,
  3514. type: "error"
  3515. });
  3516.  
  3517. resolve(false);
  3518. }
  3519. }
  3520. })
  3521. });
  3522. },
  3523.  
  3524. /*
  3525. * 预约抽奖 https://api.bilibili.com/x/space/reserve sid jsonp=jsonp csrf
  3526. * @param {Object} sid
  3527. */
  3528. reserveActivity: async function(sid) {
  3529. return new Promise((resolve) => {
  3530. Ajax.post({
  3531. url: BILIBLI_PATH.api + '/x/space/reserve',
  3532. hasCookies: true,
  3533. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  3534. data: {
  3535. sid: sid, //当前用户
  3536. jsonp: "jsonp",
  3537. csrf: Live_info.csrf_token
  3538. },
  3539. success: responseText => {
  3540. let res = HNTOOL.strToJson(responseText);
  3541. if (res.code === 0) {
  3542.  
  3543. resolve(true);
  3544. } else {
  3545. javaex.tip({
  3546. content: res.message,
  3547. type: "error"
  3548. });
  3549. resolve(false);
  3550. }
  3551. }
  3552. })
  3553. });
  3554. },
  3555. /**
  3556. reserveActivity: async function(sid, reserve_total) {
  3557. return new Promise((resolve) => {
  3558. Ajax.post({
  3559. url: BILIBLI_PATH.vcapi + '/dynamic_mix/v1/dynamic_mix/reserve_attach_card_button',
  3560. hasCookies: true,
  3561. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  3562. data: {
  3563. reserve_id: sid,
  3564. cur_btn_status: 1,
  3565. reserve_total: reserve_total,
  3566. csrf: Live_info.csrf_token
  3567. },
  3568. success: responseText => {
  3569. let res = HNTOOL.strToJson(responseText);
  3570. if (res.code === 0) {
  3571.  
  3572. resolve(res.data);
  3573. } else {
  3574.  
  3575. javaex.tip({
  3576. content: res.message,
  3577. type: "error"
  3578. });
  3579.  
  3580. resolve(false);
  3581. }
  3582. }
  3583. })
  3584. });
  3585. }, */
  3586.  
  3587. getGiftList: async function(room) {
  3588. return new Promise((resolve) => {
  3589. Ajax.get({
  3590.  
  3591. url: BILIBLI_PATH.live + '/xlive/web-room/v1/gift/bag_list',
  3592. queryStringsObj: {
  3593. "room_id": room
  3594. },
  3595. hasCookies: true,
  3596. success: responseText => {
  3597. let res = HNTOOL.strToJson(responseText);
  3598. if (res.code === 0) {
  3599.  
  3600. resolve(res.data.list);
  3601. } else {
  3602.  
  3603. javaex.tip({
  3604. content: "查询包裹失败!" + res.message,
  3605. type: "error"
  3606. });
  3607.  
  3608. resolve(false)
  3609. }
  3610. }
  3611. })
  3612. });
  3613. },
  3614.  
  3615. /**
  3616. * 送银B克拉
  3617. * @param {Object} ruid
  3618. * @param {Object} roomid
  3619. */
  3620. bagSendGift: async function(ruid, roomid, bag_id) {
  3621. return new Promise((resolve) => {
  3622. Ajax.post({
  3623. url: BILIBLI_PATH.live + '/gift/v2/live/bag_send',
  3624. hasCookies: true,
  3625. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  3626. data: {
  3627. uid: Live_info.uid, //当前用户
  3628. gift_id: 3,
  3629. ruid: ruid,
  3630. send_ruid: 0,
  3631. gift_num: 1,
  3632. bag_id: bag_id,
  3633. //rnd: Math.round(new Date() / 1000); //时间戳,
  3634. platform: 'pc',
  3635. biz_code: 'Live',
  3636. biz_id: roomid,
  3637. storm_beat_id: 0,
  3638. price: 0,
  3639. csrf_token: Live_info.csrf_token,
  3640. csrf: Live_info.csrf_token
  3641.  
  3642. },
  3643. success: responseText => {
  3644. let res = HNTOOL.strToJson(responseText);
  3645. if (res.code === 0) {
  3646.  
  3647. javaex.tip({
  3648. content: roomid + "赠送b克拉成功!" + res.message,
  3649. type: "success"
  3650. });
  3651.  
  3652. resolve(true);
  3653. } else {
  3654.  
  3655. javaex.tip({
  3656. content: res.message,
  3657. type: "error"
  3658. });
  3659.  
  3660. resolve(false);
  3661. }
  3662. }
  3663. })
  3664. });
  3665. },
  3666.  
  3667.  
  3668. /**
  3669. * 判断是否有勋章
  3670. * @param {Object} uid
  3671. * @param {Object} room
  3672. */
  3673.  
  3674. getFansMedalInfo: async function(uid, room) {
  3675. return new Promise((resolve) => {
  3676. Ajax.get({
  3677.  
  3678. url: BILIBLI_PATH.live + '/xlive/app-ucenter/v1/fansMedal/fans_medal_info',
  3679. queryStringsObj: {
  3680. "target_id": uid,
  3681. "room_id": room
  3682. },
  3683. //dataType:'application/json, text/plain, */*',
  3684. hasCookies: true,
  3685. success: responseText => {
  3686. let res = HNTOOL.strToJson(responseText);
  3687. if (res.code === 0) {
  3688.  
  3689. if (res.data.my_fans_medal.level == 0) {
  3690. resolve(false)
  3691. } else {
  3692. resolve(true)
  3693. }
  3694.  
  3695. } else {
  3696.  
  3697. javaex.tip({
  3698. content: "查询勋章失败!" + res.message,
  3699. type: "error"
  3700. });
  3701.  
  3702. resolve(false)
  3703. }
  3704. }
  3705. })
  3706. });
  3707. },
  3708.  
  3709.  
  3710.  
  3711.  
  3712. getDisuidList: async function(re_version, pn) {
  3713. return new Promise((resolve) => {
  3714. Ajax.get({
  3715.  
  3716. url: BILIBLI_PATH.api + '/x/relation/blacks',
  3717. queryStringsObj: {
  3718. "re_version": re_version,
  3719. "pn": pn
  3720. },
  3721. hasCookies: true,
  3722. success: responseText => {
  3723. let res = HNTOOL.strToJson(responseText);
  3724. if (res.code === 0) {
  3725. resolve(res.data.list)
  3726. } else {
  3727.  
  3728. javaex.tip({
  3729. content: "查询黑名单失败!" + res.message,
  3730. type: "error"
  3731. });
  3732.  
  3733. resolve(null)
  3734. }
  3735. }
  3736. })
  3737. });
  3738. },
  3739.  
  3740. /**
  3741. * @param {Object} uid
  3742. * @param {Object} act 1关注,2取关,3悄悄关注,4取消悄悄关注,5拉黑,6取消拉黑,7踢出粉丝;
  3743. */
  3744. cancelAtt: async function(uid, act, re_src) {
  3745. return new Promise((resolve) => {
  3746. Ajax.post({
  3747. url: BILIBLI_PATH.api + '/x/relation/modify',
  3748. hasCookies: true,
  3749. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  3750. data: {
  3751. fid: uid,
  3752. act: act,
  3753. re_src: re_src == undefined ? 11 : 116,
  3754. jsonp: "jsonp",
  3755. csrf: Live_info.csrf_token,
  3756. },
  3757. success: responseText => {
  3758. let res = HNTOOL.strToJson(responseText);
  3759. if (res.code === 0) {
  3760.  
  3761. //HNAPI.cancelAtt(uid, 6);
  3762.  
  3763. javaex.tip({
  3764. content: "取关成功!" + res.message,
  3765. type: "success"
  3766. });
  3767.  
  3768. resolve(true);
  3769. } else if (res.code === 22003) {
  3770.  
  3771. HNAPI.cancelAtt(uid, 6);
  3772.  
  3773. javaex.tip({
  3774. content: "取消拉黑" + res.message,
  3775. type: "success"
  3776. });
  3777. resolve(true);
  3778. } else {
  3779.  
  3780. javaex.tip({
  3781. content: res.message,
  3782. type: "error"
  3783. });
  3784.  
  3785. resolve(false);
  3786. }
  3787. }
  3788. })
  3789. });
  3790. },
  3791.  
  3792. getRoomMsg: async function(roomid) {
  3793. return new Promise((resolve) => {
  3794. Ajax.get({
  3795.  
  3796. url: BILIBLI_PATH.live + '/live_user/v1/UserInfo/get_anchor_in_room',
  3797. queryStringsObj: {
  3798. "roomid": roomid
  3799. },
  3800. hasCookies: true,
  3801. success: responseText => {
  3802. let res = HNTOOL.strToJson(responseText);
  3803. if (res.code === 0) {
  3804. resolve(res.data.info.uid)
  3805. } else {
  3806. resolve(false)
  3807. }
  3808. }
  3809. })
  3810. });
  3811. },
  3812.  
  3813. /**
  3814. *
  3815. * @param sid
  3816. * @returns {Promise<unknown>}
  3817. */
  3818. lotteryDo: async function(sid) {
  3819. return new Promise((resolve) => {
  3820. let func_url = BILIBLI_PATH.api + '/x/activity/lottery/do';
  3821. if (sid.indexOf("newLottery") != -1) {
  3822. func_url = BILIBLI_PATH.api + "/x/lottery/do";
  3823. }
  3824. Ajax.post({
  3825. url: func_url,
  3826. hasCookies: true,
  3827. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  3828. data: {
  3829.  
  3830. sid: sid,
  3831. type: 1,
  3832. csrf: Live_info.csrf_token,
  3833. },
  3834. success: responseText => {
  3835. let res = HNTOOL.strToJson(responseText);
  3836. if (res.code === 0) {
  3837. HNTOOL.console("转盘:" + sid + "\n" + (res.data)[0].gift_name);
  3838. resolve((res.data)[0].gift_name);
  3839.  
  3840. } else if (res.code === 75400) {
  3841.  
  3842. resolve(true);
  3843. } else {
  3844. javaex.tip({
  3845. content: "本次抽奖失败!" + res.message,
  3846. type: "error"
  3847. });
  3848. resolve(false);
  3849. }
  3850. }
  3851. })
  3852. });
  3853. },
  3854.  
  3855.  
  3856. getLotteryMytimes: async function(sid) {
  3857. let func_url = BILIBLI_PATH.api + '/x/activity/lottery/mytimes';
  3858. if (sid.indexOf("newLottery") != -1) {
  3859. func_url = BILIBLI_PATH.api + "/x/lottery/mytimes";
  3860. }
  3861. return new Promise((resolve) => {
  3862. Ajax.get({
  3863. url: func_url,
  3864. queryStringsObj: {
  3865. sid: sid
  3866. },
  3867. hasCookies: true,
  3868. success: responseText => {
  3869. let res = HNTOOL.strToJson(responseText);
  3870. if (res.code === 0) {
  3871. resolve(res.data.times)
  3872. } else {
  3873. resolve(0)
  3874. }
  3875. }
  3876. })
  3877. });
  3878. },
  3879.  
  3880. /**
  3881. * 增加抽奖次数一般是分享
  3882. * @param sid 活动sid
  3883. * @returns {Promise<unknown>} 0 成功 1:活动结束
  3884. */
  3885. addLotteryTimes: async function(sid) {
  3886. let func_url = BILIBLI_PATH.api + '/x/activity/lottery/addtimes';
  3887. if (sid.indexOf("newLottery") != -1) {
  3888. func_url = BILIBLI_PATH.api + "/x/lottery/addtimes";
  3889. }
  3890.  
  3891. return new Promise((resolve) => {
  3892. Ajax.post({
  3893. url: func_url,
  3894. hasCookies: true,
  3895. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  3896. data: {
  3897.  
  3898. sid: sid,
  3899. action_type: 3,
  3900. csrf: Live_info.csrf_token,
  3901. },
  3902. success: responseText => {
  3903. let res = HNTOOL.strToJson(responseText);
  3904. if (res.code === 0) {
  3905.  
  3906. resolve(0)
  3907. } else if (res.code === 75003 || res.code === 170405) {
  3908.  
  3909. resolve(1)
  3910.  
  3911. } else {
  3912.  
  3913. resolve(res.message);
  3914. }
  3915. }
  3916. })
  3917. });
  3918. },
  3919. /**
  3920. * 查询用户关注 默认一次查询50
  3921. * @param vmid 用户uid
  3922. * @param pn 页码
  3923. * @returns {Promise<unknown>}
  3924. */
  3925. getMyFollow: async function(vmid, pn) {
  3926. return new Promise((resolve) => {
  3927. Ajax.get({
  3928. url: BILIBLI_PATH.api + '/x/relation/followings',
  3929. queryStringsObj: {
  3930. vmid: vmid,
  3931. pn: pn
  3932. },
  3933. hasCookies: true,
  3934. success: responseText => {
  3935. let res = HNTOOL.strToJson(responseText);
  3936. if (res.code === 0) {
  3937. resolve(res.data)
  3938. } else {
  3939. resolve(null)
  3940. }
  3941. }
  3942. })
  3943. });
  3944. },
  3945.  
  3946.  
  3947. getMyinfo: function() {
  3948. return new Promise((resolve) => {
  3949. Ajax.get({
  3950. url: BILIBLI_PATH.api + '/x/space/myinfo',
  3951. queryStringsObj: {},
  3952. hasCookies: true,
  3953. success: responseText => {
  3954. let res = HNTOOL.strToJson(responseText);
  3955. if (res.code === 0) {
  3956. resolve(res.data)
  3957. } else {
  3958. resolve(null)
  3959. }
  3960. }
  3961. })
  3962. });
  3963. },
  3964.  
  3965. getMyJson: function(url) {
  3966. return new Promise((resolve) => {
  3967. GM_xmlhttpRequest({
  3968. method: "GET",
  3969. url: url,
  3970. onload: function(response) {
  3971. const res = HNTOOL.strToJson((response || {}).responseText)
  3972. resolve(res);
  3973. }
  3974. });
  3975. })
  3976. },
  3977.  
  3978.  
  3979. userInfo: function(mid) {
  3980.  
  3981. Ajax.get({
  3982. url: BILIBLI_PATH.api + '/x/space/acc/info',
  3983. queryStringsObj: {
  3984. mid: mid
  3985. },
  3986. hasCookies: true,
  3987. success: responseText => {
  3988.  
  3989. var json = JSON.parse(responseText);
  3990.  
  3991. if (json.code != 0) {
  3992.  
  3993.  
  3994. }
  3995. }
  3996. });
  3997.  
  3998. },
  3999.  
  4000. sendQmsg: async function(key, msg) {
  4001.  
  4002. $.ajax({
  4003. url: "https://qmsg.zendee.cn/send/" + key + "?msg=" + msg,
  4004.  
  4005. success: function(result) {
  4006.  
  4007. }
  4008. });
  4009.  
  4010.  
  4011. /*GM_xmlhttpRequest({
  4012. method: "GET",
  4013. url: `https://qmsg.zendee.cn/send/${key}?msg=${msg}`,
  4014. onload: function (response) {
  4015.  
  4016. let json = JSON.parse(response.response);
  4017. if (json.code == 0) {
  4018.  
  4019. javaex.tip({
  4020. content: "自动动态中奖提醒成功!" + json.reason,
  4021. type: "success"
  4022. });
  4023. } else {
  4024. console.log("自动动态中奖提醒失败!" + json.reason);
  4025. javaex.tip({
  4026. content: "自动动态中奖提醒失败!" + json.reason,
  4027. type: "error"
  4028. });
  4029. }
  4030.  
  4031. }
  4032. });*/
  4033.  
  4034. },
  4035.  
  4036. /**
  4037. * //https://api.bilibili.com/x/relation/modify
  4038. *
  4039. * @param UID
  4040. */
  4041. disUserByUid: function(vmid) {
  4042.  
  4043. Ajax.post({
  4044. url: BILIBLI_PATH.api + '/x/relation/modify',
  4045. data: {
  4046. fid: parseInt(vmid),
  4047. re_src: 11,
  4048. act: 5,
  4049. jsonp: "jsonp",
  4050. csrf: Live_info.csrf_token,
  4051. },
  4052. hasCookies: true,
  4053. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  4054. success: responseText => {
  4055.  
  4056. var json = JSON.parse(responseText);
  4057.  
  4058. if (json.code != 0) {
  4059.  
  4060. console.log("拉黑用户失败uid:" + vmid + " 错误信息" + json.message);
  4061. javaex.tip({
  4062. content: "拉黑用户失败uid:" + vmid + " 错误信息" + json.message,
  4063. type: "error"
  4064. });
  4065.  
  4066. } else {
  4067. console.log("拉黑用户成功 uid:" + vmid);
  4068. javaex.tip({
  4069. content: "拉黑用户成功 uid:" + vmid,
  4070. type: "success"
  4071. });
  4072. }
  4073. }
  4074. });
  4075.  
  4076. },
  4077. /**
  4078. * http://api.bilibili.com/x/web-interface/view
  4079. * @param BV
  4080. * 心跳间隔15秒
  4081. */
  4082. watchOneVideo: function(BV, MID) {
  4083.  
  4084. //1.调用点击播放接口 https://api.bilibili.com/x/click-interface/click/web/h5
  4085. Ajax.post({
  4086. url: BILIBLI_PATH.api + "/x/click-interface/click/web/h5",
  4087. hasCookies: true,
  4088. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  4089. data: {
  4090.  
  4091. "bvid": BV,
  4092. "part": 1,
  4093. "mid": Live_info.uid,
  4094. "lv": 2,
  4095. "jsonp": "jsonp",
  4096. "type": 3,
  4097. "sub_type": 0
  4098. },
  4099. success: responseText => {
  4100.  
  4101. let json = JSON.parse(responseText);
  4102.  
  4103. if (/^{"code":0/.test(responseText)) {
  4104. //发送一次心跳
  4105. HNAPI.sendHeartbeat(BV, MID);
  4106.  
  4107. } else {
  4108. javaex.tip({
  4109. content: "视频" + data.bvid + "播放失败!" + json.message,
  4110. type: "error"
  4111. });
  4112. }
  4113. }
  4114. })
  4115.  
  4116.  
  4117. },
  4118.  
  4119. //上报视频播放心跳(web端)
  4120. /**
  4121. * http://api.bilibili.com/x/click-interface/web/heartbeat
  4122. * @param json
  4123. */
  4124. sendHeartbeat: function(bvid, MID) {
  4125.  
  4126. Ajax.post({
  4127. url: BILIBLI_PATH.api + "/x/click-interface/web/heartbeat",
  4128. hasCookies: true,
  4129. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  4130. //aid=756988764&bvid=BV1wr4y1P782&cid=304166326&page=1
  4131. data: {
  4132. "bvid": bvid,
  4133. "type": 3,
  4134. "dt": 2,
  4135. "played_time": HNTOOL.random(12, 40),
  4136. "realtime": HNTOOL.random(12, 40),
  4137. "play_type": 0
  4138. },
  4139. success: responseText => {
  4140.  
  4141. if (/^{"code":0/.test(responseText) && MID != BiliData.author_uid) {
  4142.  
  4143. javaex.tip({
  4144. content: "视频BV" + bvid + "播放一次!",
  4145. type: "success"
  4146. });
  4147. }
  4148. }
  4149. })
  4150.  
  4151. },
  4152.  
  4153. //获取up所有投稿视频
  4154. /**
  4155. * https://api.bilibili.com/x/space/arc/search?mid=99439379&ps=30&tid=0&pn=1&keyword=&order=pubdate&jsonp=jsonp
  4156. * @param mid
  4157. */
  4158. getUpAllBV: function(mid, pn, ps) {
  4159. ps = (ps === undefined ? 30 : ps); // a默认值为1
  4160. Ajax.get({
  4161. url: BILIBLI_PATH.api + '/x/space/arc/search',
  4162. queryStringsObj: {
  4163. mid: mid,
  4164. tid: 0,
  4165. order: 'pubdate',
  4166. jsonp: 'jsonp',
  4167. pn: pn,
  4168. ps: ps
  4169. },
  4170. hasCookies: true,
  4171. success: responseText => {
  4172.  
  4173. var json = JSON.parse(responseText);
  4174.  
  4175. if (json.code != 0) {
  4176.  
  4177. javaex.tip({
  4178. content: "获取up所有投稿视频失败!" + json.message,
  4179. type: "success"
  4180. });
  4181.  
  4182. } else {
  4183. BiliData.BVList = json.data.list.vlist;
  4184.  
  4185. }
  4186. }
  4187. });
  4188.  
  4189. },
  4190.  
  4191.  
  4192. /**
  4193. *
  4194. * @param path
  4195. * @param data
  4196. * @param saveObj
  4197. * @param Func
  4198. */
  4199. publicGet: function(path, queryStringsObj) {
  4200.  
  4201. if (typeof(queryStringsObj) != "undefined") {
  4202. queryStringsObj = {};
  4203. }
  4204. Ajax.get({
  4205. url: BILIBLI_PATH.api + path,
  4206. queryStringsObj: queryStringsObj,
  4207. hasCookies: true,
  4208. success: responseText => {
  4209.  
  4210. let json = JSON.parse(responseText);
  4211. if (chackCode(json.code) && json.code == 0) {
  4212.  
  4213. return json.data;
  4214. }
  4215.  
  4216. return false;
  4217.  
  4218. }
  4219. })
  4220.  
  4221. },
  4222.  
  4223. /**
  4224. * 导航栏用户信息
  4225. */
  4226. getUserNav: async function() {
  4227.  
  4228. GM_xmlhttpRequest({
  4229. method: "GET",
  4230. url: BILIBLI_PATH.api + "/x/web-interface/nav",
  4231. //timeout:3000,
  4232. onload: function(response) {
  4233.  
  4234. let json = JSON.parse(response.response);
  4235. console.log(json);
  4236. BiliData.login_code = json.code;
  4237. BiliData.login_message = json.message;
  4238. BiliData.LoginData = json.data;
  4239.  
  4240. }
  4241. });
  4242.  
  4243. },
  4244.  
  4245. /**
  4246. * 获取某up详细信息
  4247. * http://api.bilibili.com/x/web-interface/card
  4248. */
  4249. getUpCard: function(mid) {
  4250.  
  4251. Ajax.get({
  4252. url: BILIBLI_PATH.api + '/x/web-interface/card',
  4253. queryStringsObj: {
  4254. mid: mid,
  4255. photo: false
  4256. },
  4257. hasCookies: true,
  4258. success: responseText => {
  4259.  
  4260. var json = JSON.parse(responseText);
  4261.  
  4262. if (json.code != 0) {
  4263.  
  4264. javaex.tip({
  4265. content: "查询失败!" + json.message,
  4266. type: "success"
  4267. });
  4268. return false;
  4269. } else {
  4270. BiliData.upCard = json;
  4271.  
  4272. }
  4273.  
  4274.  
  4275. }
  4276. })
  4277.  
  4278. },
  4279.  
  4280. /**
  4281. *
  4282. * @param uid 用户uid
  4283. * @param ps 每页视频个数 默认30个
  4284. * @param pn 第几页
  4285. */
  4286. getUpAllVideo: function(uid, ps, pn) {
  4287.  
  4288. },
  4289. getChallenge: async function() {
  4290.  
  4291.  
  4292. },
  4293. /**
  4294. * 硬币记录
  4295. * @returns {Promise<void>}
  4296. */
  4297. getCoinLog: async function() {
  4298.  
  4299. GM_xmlhttpRequest({
  4300. method: "GET",
  4301. url: BILIBLI_PATH.api + "/x/member/web/coin/log",
  4302. //url: "http://api.bilibili.com/x/member/web/coin/log",
  4303. onload: function(response) {
  4304.  
  4305. let json = JSON.parse(response.response);
  4306. if (json.code == 0) {
  4307.  
  4308. console.log("硬币记录" + json);
  4309. BiliData.CoinLog = json.data;
  4310.  
  4311. return true;
  4312. }
  4313.  
  4314. }
  4315. });
  4316. },
  4317. /**
  4318. * 未读消息数 http://api.bilibili.com/x/msgfeed/unread
  4319. * @returns {Promise<void>}
  4320. */
  4321. getUnread: async function() {
  4322.  
  4323. Ajax.get({
  4324. url: BILIBLI_PATH.api + "/x/msgfeed/unread",
  4325. hasCookies: true,
  4326. success: responseText => {
  4327.  
  4328. let json = JSON.parse(responseText);
  4329. if (chackCode(json.code) && json.code == 0) {
  4330.  
  4331. BiliData.Unread = json.data;
  4332. showUnreadMsg();
  4333. }
  4334.  
  4335. return false;
  4336.  
  4337. }
  4338. })
  4339.  
  4340. /* GM_xmlhttpRequest({
  4341. method: "GET",
  4342. url: BILIBLI_PATH.api + "/x/msgfeed/unread",
  4343. onload: function (response) {
  4344.  
  4345. let json = JSON.parse(response.response);
  4346.  
  4347. if (chackCode(json.code) && json.code == 0) {
  4348.  
  4349. BiliData.Unread = json.code;
  4350. showUnreadMsg();
  4351.  
  4352. }
  4353.  
  4354. }
  4355. });*/
  4356. },
  4357. /**
  4358. *
  4359. * @param type reply:回复我的 at @我的
  4360. */
  4361. getMsgfeed: function(type) {
  4362. Ajax.get({
  4363. url: BILIBLI_PATH.api + '/x/msgfeed/' + type,
  4364. queryStringsObj: {
  4365. build: 0,
  4366. mobi_app: 'web'
  4367. },
  4368. hasCookies: true,
  4369. success: responseText => {
  4370.  
  4371. var json = JSON.parse(responseText);
  4372.  
  4373. if (json.code != 0 || !json.data.cursor.is_end || json.data.items == null) {
  4374. return false;
  4375. } else {
  4376. chackAtMsg(json.data.items);
  4377.  
  4378. return true;
  4379. }
  4380.  
  4381.  
  4382. }
  4383. })
  4384.  
  4385. },
  4386.  
  4387. /** 未读消息数 http://api.bilibili.com/x/space/arc/search?mid=99439379&pn=1&ps=5
  4388. * @returns {Promise<void>}
  4389. */
  4390. getUnrewad: async function() {
  4391.  
  4392. GM_xmlhttpRequest({
  4393. method: "GET",
  4394. data: {
  4395. "mid": 99439379,
  4396. "pn": 1,
  4397. "ps": 5,
  4398. },
  4399. url: BILIBLI_PATH.api + "/x/space/arc/search",
  4400. onload: function(response) {
  4401.  
  4402. let json = JSON.parse(response.response);
  4403. if (json.code == 0) {
  4404.  
  4405. BiliData.Video = json.data;
  4406. console.log("未读消息数" + json);
  4407. }
  4408.  
  4409. }
  4410. });
  4411. },
  4412.  
  4413. /** 动态评论区点赞 https://api.bilibili.com/x/v2/reply/action
  4414. * @param {number} oid
  4415. * @param {nbumber} rpid
  4416. * @param {number} action
  4417. * @returns {Promise<void>}
  4418. * type: 11
  4419. * ordering: heat
  4420. * jsonp: jsonp
  4421. * csrf: 54a******* CSRF Token(位于cookie)
  4422. */
  4423.  
  4424. likeInDynamicComments: async function(latestDynamic) {
  4425.  
  4426.  
  4427. Ajax.post({
  4428. url: BILIBLI_PATH.api + "/x/v2/reply/action",
  4429. hasCookies: true,
  4430. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  4431. data: {
  4432. "oid": oid,
  4433. "type": 11,
  4434. "rpid": rpid,
  4435. "action": action,
  4436. "ordering": "heat",
  4437. "jsonp": "jsonp",
  4438. "csrf": Live_info.csrf_token,
  4439. },
  4440. success: responseText => {
  4441.  
  4442. if (/^{"code":0/.test(responseText)) {
  4443.  
  4444. BiliData.replyAction = JSON.parse(responseText);
  4445. console.log("点赞成功!" + responseText);
  4446. }
  4447. }
  4448. })
  4449.  
  4450. }
  4451.  
  4452.  
  4453. }
  4454.  
  4455. /*-----------------------------------------------常用工具函数--------------------------------------------------*/
  4456. var http_request = null;
  4457.  
  4458. function send_request(url, method) {}
  4459.  
  4460. let HNTOOL = {
  4461. /**
  4462. * 判断是否为整数类型方式
  4463. * @param {Object} obj
  4464. */
  4465. isInteger: function(obj) {
  4466.  
  4467. return obj % 1 === 0
  4468.  
  4469. },
  4470.  
  4471. jury_case: async function() {
  4472.  
  4473. for (let i = 0; i < 30; i++) {
  4474.  
  4475. //1.获取题号
  4476. let case_id = await HNAPI.jury_case_next();
  4477. await HNTOOL.Sleep(1000);
  4478. if (case_id == false) {
  4479. break;
  4480. }
  4481. //2.获取该题号详情
  4482. let vote = await HNAPI.jury_case_info(case_id);
  4483. await HNTOOL.Sleep(4 * 1000);
  4484. if (vote == false) {
  4485. break;
  4486. }
  4487. let opinion = await HNAPI.jury_case_opinion(case_id);
  4488. await HNTOOL.Sleep(15 * 1000);
  4489. //3.开始答题
  4490. let result = await HNAPI.jury_vote(case_id, vote, 1);
  4491. if (result) {
  4492. HNTOOL.console("第" + (i + 1) + "个案号:" + case_id + "完成!");
  4493. } else {
  4494. alert(result);
  4495. }
  4496. let case_id3 = await HNAPI.jury_case_next();
  4497.  
  4498. }
  4499.  
  4500. },
  4501. console: function(str, type) {
  4502.  
  4503. console.log(javaex.now() + "\n" + str);
  4504.  
  4505. javaex.tip({
  4506. content: str,
  4507. type: type == undefined || type == "success" ? "success" : type
  4508. });
  4509.  
  4510. },
  4511.  
  4512. doOneDynamic: async function(randomtime) {
  4513.  
  4514. var myVar = setInterval(async function() {
  4515.  
  4516. let randomStr = await HNTOOL.getRandomString();
  4517. await HNAPI.sendOneDynamic(randomStr);
  4518.  
  4519. }, randomtime);
  4520. },
  4521.  
  4522. getRandomString: function() {
  4523.  
  4524. return new Promise((resolve) => {
  4525. Ajax.get({
  4526. url: "https://api.mcloc.cn/love/",
  4527. //url: 'https://api.mcloc.cn/words/?type=json',//随机一个句子
  4528. //url: 'https://interface.meiriyiwen.com/article/random?dev=1',//随机一个句子
  4529. queryStringsObj: {
  4530. type: "json"
  4531. },
  4532. dataType: "text/html; charset=UTF-8",
  4533. hasCookies: false,
  4534. success: responseText => {
  4535.  
  4536. try {
  4537. let res = HNTOOL.strToJson(responseText);
  4538. resolve(res.data); //随机一句情话
  4539. //resolve(body.data+"---"+body.creator);//随机一个句子
  4540. //resolve(body.data.digest);//随机一个句子
  4541. } catch (e) {
  4542.  
  4543. resolve("你的名字,是我见过最短的情诗。"); //随机一句情话
  4544. }
  4545.  
  4546.  
  4547. }
  4548. })
  4549. });
  4550. },
  4551.  
  4552. getLatestDynamic: async function() {
  4553.  
  4554. let latestDynamic = await HNAPI.getTodayDynamicList(226257459, 3);
  4555. await HNTOOL.Sleep(1000);
  4556. let ldList = [];
  4557. let ldList2 = [];
  4558. for (let ld1 of latestDynamic) {
  4559.  
  4560. let ld = await HNTOOL.getDynamicIdList(ld1);
  4561. await HNTOOL.Sleep(1000);
  4562. ldList = ldList.concat(ld);
  4563. }
  4564.  
  4565. let latestDynamic2 = await HNAPI.getTodayDynamicList(2295698, 2);
  4566. await HNTOOL.Sleep(1000);
  4567.  
  4568. for (let ld2 of latestDynamic) {
  4569.  
  4570. let ld = await HNTOOL.getDynamicIdList(ld2);
  4571. await HNTOOL.Sleep(1000);
  4572. ldList2 = ldList2.concat(ld);
  4573. }
  4574. ldList.push.apply(ldList, ldList2);
  4575.  
  4576. let result = HNTOOL.arrUnique(ldList, false);
  4577.  
  4578. return result;
  4579.  
  4580. },
  4581.  
  4582. getDynamicIdList: async function(latestDynamic) {
  4583.  
  4584.  
  4585.  
  4586. return new Promise((resolve) => {
  4587. Ajax.get({
  4588. url: "https://www.bilibili.com/read/cv" + latestDynamic.id,
  4589. queryStringsObj: {
  4590.  
  4591. },
  4592. dataType: "text/html; charset=utf-8",
  4593. hasCookies: true,
  4594. success: responseText => {
  4595. let datalist = HNTOOL.httpString(responseText);
  4596. let dls;
  4597. let returnlist = [];
  4598. if (datalist != undefined && datalist.length > 0) {
  4599. for (let dl of datalist) {
  4600.  
  4601. let len = dl.indexOf("?");
  4602. if (len == -1) {
  4603. dl += "?tab=2";
  4604. }
  4605. dls = dl.substring(dl.indexOf("?") - 18, dl.indexOf("?"));
  4606. if (dls == false ||
  4607. dls == null ||
  4608. dl.indexOf("read") > -1 ||
  4609. dl.indexOf("html") > -1 ||
  4610. dl.indexOf("pixiv") > -1 ||
  4611. returnlist.indexOf(dls) > -1) {
  4612. continue;
  4613. }
  4614.  
  4615. returnlist.push(dls);
  4616.  
  4617. }
  4618.  
  4619. resolve(HNTOOL.arrUnique(returnlist, false));
  4620. } else {
  4621. resolve(false);
  4622. }
  4623. }
  4624. })
  4625. });
  4626. },
  4627.  
  4628. httpString: function(s) {
  4629. //var reg = /(http:\/\/|https:\/\/)((\w|=|\?|\.|\/|&|-)+)/g;
  4630. //var reg = /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/;
  4631. //var reg=/(http(s)?\:\/\/)?(www\.)?(\w+\:\d+)?(\/\w+)+\.(swf|gif|jpg|bmp|jpeg)/gi;
  4632. //var reg=/(http(s)?\:\/\/)?(www\.)?(\w+\:\d+)?(\/\w+)+\.(swf|gif|jpg|bmp|jpeg)/gi;
  4633. var reg = /(https?|http|ftp|file):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/g;
  4634. //var reg= /^((ht|f)tps?):\/\/[\w\-]+(\.[\w\-]+)+([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?$/;
  4635. //v = v.replace(reg, "<a href='$1$2'>$1$2</a>"); //这里的reg就是上面的正则表达式
  4636. //s = s.replace(reg, "$1$2"); //这里的reg就是上面的正则表达式
  4637. s = s.match(reg);
  4638. console.log(s)
  4639. return (s)
  4640. },
  4641.  
  4642. saveConfig: function() {
  4643.  
  4644. localStorage.setItem(`HN_SETUP_CONFIG`, JSON.stringify(HN_SETUP_CONFIG));
  4645. /* javaex.tip({
  4646. content: "配置保存成功!",
  4647. type: "success"
  4648. }); */
  4649.  
  4650. },
  4651.  
  4652. copyText: function(domId) {
  4653. let btn = document.getElementById(domId);
  4654. btn.select();
  4655. if (document.execCommand('copy')) {
  4656. document.execCommand('copy');
  4657. javaex.tip({
  4658. content: "复制成功!",
  4659. type: "success"
  4660. });
  4661. }
  4662.  
  4663. },
  4664. /**
  4665. * s数组去重并排序
  4666. */
  4667.  
  4668. arrUnique: function(ary, isSort) {
  4669.  
  4670. if (isSort == undefined) {
  4671. isSort = true
  4672. }
  4673. let obj = {};
  4674. for (let i = 0; i < ary.length; i++) { //this 指向方法.前的对象ary
  4675. let item = ary[i]
  4676. obj.hasOwnProperty(item) ? (ary[i] = ary[ary.length - 1], ary.pop(), i--) : obj[item] = item
  4677. } //判断对象obj中是否有item元素,如果有 让当前元素等于数组最后一个元素,删除最后一个元素
  4678. // 如果没有 将这个元素添加到对象中
  4679. if (isSort) {
  4680. ary.sort((a, b) => {
  4681. return a - b
  4682. }) // 数组去重后 按升序排列
  4683. }
  4684.  
  4685. obj = null;
  4686.  
  4687. javaex.tip({
  4688. content: "已去重!",
  4689. type: "success"
  4690. });
  4691. return ary;
  4692.  
  4693. },
  4694.  
  4695. split_array: function(arr, len) {
  4696.  
  4697. let arr_length = arr.length;
  4698. let newArr = [];
  4699. for (let i = 0; i < arr_length; i += len) {
  4700. newArr.push(arr.slice(i, i + len));
  4701. }
  4702. return newArr;
  4703. },
  4704. strToJson: function(params) {
  4705. const isJSON = (str => {
  4706. if (typeof str === 'string') {
  4707. try {
  4708. const obj = JSON.parse(str);
  4709. return typeof obj === 'object' ? obj : false
  4710. } catch (_) {
  4711. console.log(str);
  4712. return false;
  4713. }
  4714. } else {
  4715. console.log(`${str}\nIt is not a string!`);
  4716. return false;
  4717. }
  4718. })(params);
  4719. return isJSON ? isJSON : {}
  4720. },
  4721.  
  4722. chackAtMsg: function() {
  4723.  
  4724. let config = HNTOOL.getConfig();
  4725. if (config.qmsg_checked == true && config.qmsg_key) {
  4726.  
  4727. document.getElementById("getAtMsg").click();
  4728.  
  4729. }
  4730.  
  4731. },
  4732.  
  4733. cssChecked: function(id, dom) {
  4734.  
  4735. dom == true ? $(id).attr("checked", true) : $(id).removeProp("checked");
  4736.  
  4737.  
  4738. },
  4739. getConfig: function() {
  4740.  
  4741. let CONFIG = JSON.parse(localStorage.getItem(`HN_SETUP_CONFIG`));
  4742.  
  4743. if (CONFIG == null) {
  4744. CONFIG = HN_SETUP_CONFIG;
  4745. }
  4746.  
  4747. return CONFIG;
  4748. },
  4749.  
  4750. /**
  4751. * 获取cookie 中某个键对应的值
  4752. * @param name
  4753. */
  4754.  
  4755. getCookie: function(name) {
  4756. let arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
  4757. if (arr != null) return escape(arr[2]);
  4758. return false;
  4759. },
  4760. /**
  4761. * 得到一个字符串数组的中随机一个
  4762. * @param {List} list
  4763. */
  4764.  
  4765.  
  4766. getRandomWordOfList: function(list) {
  4767. var L = list.length;
  4768. var i = Math.ceil(Math.random() * (L - 1));
  4769.  
  4770. return list[i];
  4771. },
  4772. random: function(min, max) {
  4773.  
  4774. return Math.floor(Math.random() * (max - min)) + min;
  4775. },
  4776.  
  4777. Sleep: function(ms) {
  4778. return new Promise(resolve => setTimeout(() => resolve('sleep'), ms));
  4779. }
  4780.  
  4781. }
  4782.  
  4783. let errorMsg = {
  4784. "-1": "应用程序不存在或已被封禁!",
  4785. "-2": "Access Key错误!",
  4786. "-3": "API校验密匙错误!",
  4787. "-4": "调用方对该Method没有权限!",
  4788. "-101": "账号未登录!",
  4789. "-102": "账号被封停!",
  4790. "-103": "积分不足!",
  4791. "-104": "硬币不足!",
  4792. "-105": "验证码错误!",
  4793. "-106": "账号非正式会员或在适应期!",
  4794. "-107": "应用不存在或者被封禁!",
  4795. "-108": "未绑定手机!",
  4796. "-109": "未知!",
  4797. "-110": "未绑定手机!",
  4798. "-111": "csrf 校验失败!",
  4799. "-112": "系统升级中!",
  4800. "-113": "账号尚未实名认证!",
  4801. "-114": "请先绑定手机!",
  4802. "-115": "请先完成实名认证!",
  4803. "-304": "木有改动!",
  4804. "-307": "撞车跳转!",
  4805. "-400": "请求错误!",
  4806. "-401": "未认证!",
  4807. "-403": "访问权限不足!",
  4808. "-404": "啥都木有!",
  4809. }
  4810.  
  4811. /*-----------------------------------------------CODE 统一检查--------------------------------------------------*/
  4812. /**
  4813. *
  4814. * @param code
  4815. * @constructor
  4816. */
  4817. let chackCode = function(code) {
  4818.  
  4819. let emsg = errorMsg[code + ""];
  4820. if (emsg != null) {
  4821. javaex.tip({
  4822. content: emsg,
  4823. type: "error"
  4824. });
  4825.  
  4826. return false;
  4827. }
  4828.  
  4829. return true;
  4830. }
  4831.  
  4832.  
  4833. /*-----------------------------------------------localStorage封装 (本地存储信息)--------------------------------------------------*/
  4834. //javaex.setLocalStorage(key, value); var str = javaex.getLocalStorage(key); javaex.deleteLocalStorage(key);
  4835.  
  4836. /*window.onbeforeunload = function() {
  4837. if (!canLeavePage()) {
  4838. return ('确认离开当前页面吗?未保存的数据将会丢失!');
  4839. }
  4840. };*/
  4841.  
  4842.  
  4843. /**
  4844. * Ajax请求对象
  4845. */
  4846. const Ajax = (() => {
  4847. /**
  4848. * 检查options是否符合要求
  4849. * @param {object} options
  4850. * @returns {boolean}
  4851. */
  4852. function checkOptions(options) {
  4853. let result = false;
  4854. if (typeof options !== 'object') {
  4855. console.warn('类型错误: typeof Options !== Object');
  4856. return result;
  4857. } else {
  4858. if (typeof options.url !== 'string') {
  4859. console.warn('类型错误: typeof Link !== Strings');
  4860. return result;
  4861. } else {
  4862. const reg = /(https?|http|ftp|file):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/g;
  4863. //const reg = /^https?:\/\/(?:\w+\.?)+(?:\/.*)*\/?$/i;
  4864. if (!reg.test(options.url)) {
  4865. console.warn('url字符串须为完整http链接');
  4866. return result;
  4867. }
  4868. result = true;
  4869. }
  4870. }
  4871. return result;
  4872. }
  4873.  
  4874. /**
  4875. * 对象转URL编码
  4876. * @param {object} data
  4877. */
  4878. function objToURLCode(data) {
  4879. var _result = [];
  4880. for (var key in data) {
  4881. var value = data[key];
  4882. if (value instanceof Array) {
  4883. value.forEach(function(_value) {
  4884. _result.push(key + "=" + _value);
  4885. });
  4886. } else {
  4887. _result.push(key + '=' + value);
  4888. }
  4889. }
  4890. return _result.join('&');
  4891. }
  4892.  
  4893. /**
  4894. * 请求
  4895. * @param {string} method
  4896. * @param {object} options
  4897. */
  4898. function request(method, options) {
  4899. if (checkOptions(options)) {
  4900. let xhr = new XMLHttpRequest();
  4901. const {
  4902. url: _url,
  4903. queryStringsObj,
  4904. data,
  4905. dataType,
  4906. payload,
  4907. hasCookies
  4908. } = options, url = typeof queryStringsObj === 'object' ?
  4909. _url + '?' + objToURLCode(queryStringsObj) : _url;
  4910. switch (method) {
  4911. case 'GET':
  4912. xhr.open("GET", url);
  4913. break;
  4914. case 'POST':
  4915. xhr.open("POST", url);
  4916. xhr.setRequestHeader('Content-Type', dataType);
  4917. //xhr.setRequestHeader('Accept-Encoding', "Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30");
  4918. break;
  4919. default:
  4920. break;
  4921. }
  4922. if (hasCookies) xhr.withCredentials = true;
  4923. xhr.timeout = 3000;
  4924. xhr.addEventListener('load', () => {
  4925. if (xhr.status === 200) {
  4926. options.success(xhr.responseText)
  4927. } else {
  4928. console.error(`status:${xhr.status}`);
  4929. options.success(`{"code":${xhr.status},"msg":"频繁访问"}`);
  4930. }
  4931. })
  4932. xhr.addEventListener('error', () => {
  4933. console.error('ajax请求出错')
  4934. options.success('{"code":-1,"msg":"ajax请求出错"}');
  4935. })
  4936. xhr.addEventListener('timeout', () => {
  4937. console.error('请求超时')
  4938. options.success('{"code":-1,"msg":"请求超时"}');
  4939. })
  4940. switch (method) {
  4941. case 'GET':
  4942. xhr.send()
  4943. break;
  4944. case 'POST':
  4945. xhr.send((/urlencoded/.test(dataType)) ? objToURLCode(data) : data)
  4946. //xhr.send(payload);
  4947. break;
  4948. default:
  4949. break;
  4950. }
  4951. }
  4952. }
  4953.  
  4954. return {
  4955. /**
  4956. * 发送Get请求
  4957. * @param {Object} options
  4958. */
  4959. get(options) {
  4960. request("GET", options);
  4961. },
  4962. /**
  4963. * 发送Post请求
  4964. * @param {object} options
  4965. */
  4966. post(options) {
  4967. request("POST", options);
  4968. }
  4969. }
  4970. })()