shawenguan hace 1 año
padre
commit
cdd68dc65a
Se han modificado 1 ficheros con 68 adiciones y 68 borrados
  1. 68 68
      Scripts/bilibili/bilibiliHelper.js

+ 68 - 68
Scripts/bilibili/bilibiliHelper.js

@@ -489,74 +489,74 @@ async function share(aid, cid, short_link) {
     });
 }
 
-async function coin() {
-    return new Promise((resolve, reject) => {
-        if (config.coins.num >= 50) {
-            magicJS.logger.info(`- 今日已完成 ${config.coins.time}`);
-            resolve();
-            return;
-        }
-        let like_uid_list = await getFavUid()
-        if (like_uid_list && like_uid_list.length > 0) {
-            let aid = await getFavAid(like_uid_list)
-            //magicJS.logger.info("即将投币的视频aid: " + aid)
-            if (aid !== 0) {
-                const body = {
-                    aid,
-                    multiply: 1,
-                    select_like: 0,
-                    cross_domain: true,
-                    csrf: config.cookie.bili_jct
-                }
-                const myRequest = {
-                    url: "https://api.bilibili.com/x/web-interface/coin/add",
-                    headers: {
-                        'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36',
-                        'accept': 'application/json, text/plain, */*',
-                        'content-type': 'application/x-www-form-urlencoded',
-                        'origin': 'https://www.bilibili.com',
-                        'referer': 'https://www.bilibili.com/video/BV1MT411G7fG?vd_source=1970993e2eff4af7be029aefcfa468b8',
-                        'cookie': config.cookieStr + ';buvid3=fuckchenruilovelaoliu'
-                    },
-                    body: magicJS.objToQueryStr(body)
-                }
-                magicJS.http.post(myRequest).then(async response => {
-                    try {
-                        const body = response.body;
-                        if (body?.code === 0 && body?.message === "0") {
-                            magicJS.logger.info("- 投币成功");
-                            config.user.money -= 1;
-                            config.coins.num += 10;
-                            magicJS.data.write("bilibili_daily_bonus", magicJS.toStr(config));
-                        } else {
-                            magicJS.logger.info("- 投币失败,失败原因 " + body.message);
-                            config.coins.failures = (config.coins.failures === 0 || typeof config.coins.failures === 'undefined' ? 1 : config.coins.failures + 1);
-                            magicJS.data.write("bilibili_daily_bonus", magicJS.toStr(config));
-                            if (config.coins.failures < 11) {
-                                magicJS.logger.info("- 正在重试...重试次数 " + (config.coins.failures - 1) + "(超过十次不再重试)");
-                                await coin();
-                            }
-                        }
-                    } catch (e) {
-                        magicJS.logger.error(e);
-                    } finally {
-                        resolve();
-                    }
-                }).catch(err => {
-                    const msg = `投币异常\n${JSON.stringify(err)}`;
-                    magicJS.logger.error(msg);
-                    reject();
-                });
-            } else {
-                magicJS.logger.info("获取随机投币视频失败");
-                resolve();
-            }
-        } else {
-            magicJS.logger.info("获取随机关注用户列表失败");
-            resolve();
-        }
-    });
-}
+// async function coin() {
+//     return new Promise((resolve, reject) => {
+//         if (config.coins.num >= 50) {
+//             magicJS.logger.info(`- 今日已完成 ${config.coins.time}`);
+//             resolve();
+//             return;
+//         }
+//         let like_uid_list = await getFavUid()
+//         if (like_uid_list && like_uid_list.length > 0) {
+//             let aid = await getFavAid(like_uid_list)
+//             //magicJS.logger.info("即将投币的视频aid: " + aid)
+//             if (aid !== 0) {
+//                 const body = {
+//                     aid,
+//                     multiply: 1,
+//                     select_like: 0,
+//                     cross_domain: true,
+//                     csrf: config.cookie.bili_jct
+//                 }
+//                 const myRequest = {
+//                     url: "https://api.bilibili.com/x/web-interface/coin/add",
+//                     headers: {
+//                         'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36',
+//                         'accept': 'application/json, text/plain, */*',
+//                         'content-type': 'application/x-www-form-urlencoded',
+//                         'origin': 'https://www.bilibili.com',
+//                         'referer': 'https://www.bilibili.com/video/BV1MT411G7fG?vd_source=1970993e2eff4af7be029aefcfa468b8',
+//                         'cookie': config.cookieStr + ';buvid3=fuckchenruilovelaoliu'
+//                     },
+//                     body: magicJS.objToQueryStr(body)
+//                 }
+//                 magicJS.http.post(myRequest).then(async response => {
+//                     try {
+//                         const body = response.body;
+//                         if (body?.code === 0 && body?.message === "0") {
+//                             magicJS.logger.info("- 投币成功");
+//                             config.user.money -= 1;
+//                             config.coins.num += 10;
+//                             magicJS.data.write("bilibili_daily_bonus", magicJS.toStr(config));
+//                         } else {
+//                             magicJS.logger.info("- 投币失败,失败原因 " + body.message);
+//                             config.coins.failures = (config.coins.failures === 0 || typeof config.coins.failures === 'undefined' ? 1 : config.coins.failures + 1);
+//                             magicJS.data.write("bilibili_daily_bonus", magicJS.toStr(config));
+//                             if (config.coins.failures < 11) {
+//                                 magicJS.logger.info("- 正在重试...重试次数 " + (config.coins.failures - 1) + "(超过十次不再重试)");
+//                                 await coin();
+//                             }
+//                         }
+//                     } catch (e) {
+//                         magicJS.logger.error(e);
+//                     } finally {
+//                         resolve();
+//                     }
+//                 }).catch(err => {
+//                     const msg = `投币异常\n${JSON.stringify(err)}`;
+//                     magicJS.logger.error(msg);
+//                     reject();
+//                 });
+//             } else {
+//                 magicJS.logger.info("获取随机投币视频失败");
+//                 resolve();
+//             }
+//         } else {
+//             magicJS.logger.info("获取随机关注用户列表失败");
+//             resolve();
+//         }
+//     });
+// }
 
 async function getFavUid() {
     return new Promise((resolve, reject) => {