掘金签到和自动抽奖

每日掘金签到和自动抽奖

  1. // ==UserScript==
  2. // @name 掘金签到和自动抽奖
  3. // @namespace https://bbs.tampermonkey.net.cn/
  4. // @version 0.2.2
  5. // @description 每日掘金签到和自动抽奖
  6. // @author Wyz
  7. // @crontab * 1-23 once * *
  8. // @grant GM_xmlhttpRequest
  9. // @grant GM_notification
  10. // @grant GM_getValue
  11. // @connect api.juejin.cn
  12. // @grant GM_xmlhttpRequest
  13. // @require https://cdn.jsdelivr.net/npm/scriptcat-lib@1.1.3/dist/gm.js
  14. // @definition https://cdn.jsdelivr.net/npm/scriptcat-lib@1.1.3/src/types/gm.d.ts
  15. // @cloudCat
  16. // @exportCookie domain=.juejin.cn
  17. // @exportValue 掘金.aid,掘金.uuid,掘金._signature
  18. // @match undefined
  19. // @license MIT
  20. // ==/UserScript==
  21.  
  22. /* ==UserConfig==
  23. 掘金:
  24. aid:
  25. title: aid
  26. description: 请在签到页面上使用开发者工具抓取aid,可以搜索check_in_rules请求查看
  27. uuid:
  28. title: uuid
  29. description: 请在签到页面上使用开发者工具抓取aid,可以搜索check_in_rules请求查看
  30. _signature:
  31. title: _signature
  32. description: 请在签到页面上使用开发者工具抓取_signature,可以搜索check_in_rules请求查看
  33. ==/UserConfig== */
  34.  
  35. return new Promise(async (resolve) => {
  36. let aid = GM_getValue('aid');
  37. let uuid = GM_getValue('uuid');
  38. let _signature = GM_getValue('_signature');
  39. let client = gm.ajax.create({
  40. validateStatus(status) {
  41. return status < 500;
  42. }
  43. });
  44. try {
  45. let resp = await client.post(`https://api.juejin.cn/growth_api/v1/check_in?aid=${aid}&uuid=${uuid}&_signature=${_signature}`, { responseType: 'json' });
  46. let msg = '';
  47. if (resp.data.err_no === 0) {
  48. msg = '签到成功\n';
  49. } else {
  50. msg = '签到失败: ' + resp.data.err_msg + "\n";
  51. }
  52. resp = await client(`https://api.juejin.cn/growth_api/v1/lottery_config/get?aid=${aid}&uuid=${uuid}`, { responseType: 'json' });
  53. if (resp.data.err_no === 0) {
  54. if (resp.data.data.free_count === 1) {
  55. resp = await client.post(`https://api.juejin.cn/growth_api/v1/lottery/draw?aid=${aid}&uuid=${uuid}&_signature=${_signature}`, { responseType: 'json' });
  56. if (resp.data.err_no === 0) {
  57. msg += "抽奖成功: " + resp.data.data.lottery_name;
  58. } else {
  59. msg += "抽奖失败: " + resp.data.err_msg;
  60. }
  61. } else {
  62. msg += '无抽免费奖次数'
  63. }
  64. } else {
  65. msg += '获取失败: ' + resp.data.err_msg;
  66. }
  67. GM_notification(msg, '掘金签到和自动抽奖');
  68. resolve(msg);
  69. } catch (e) {
  70. console.log(e);
  71. GM_notification('网络错误,签到失败,请手动重试', '掘金签到和自动抽奖');
  72. resolve('签到失败');
  73. }
  74. });

QingJ © 2025

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