autoSign

一些论坛的自动签到脚本,目前支持4个网站:sstm,2djgame,acfun,lightnovel

  1. // ==UserScript==
  2. // @name autoSign
  3. // @author setycyas
  4. // @namespace https://gf.qytechs.cn/zh-CN/users/14059-setycyas
  5. // @description 一些论坛的自动签到脚本,目前支持4个网站:sstm,2djgame,acfun,lightnovel
  6. // @include *
  7. // @version 1
  8. // @grant GM_setValue
  9. // @grant GM_getValue
  10. // @grant GM_xmlhttpRequest
  11. // @grant GM_registerMenuCommand
  12. // @grant GM_xmlhttpRequest
  13. // @run-at document-end
  14. // @license MIT
  15. // ==/UserScript==
  16. //是否测试中,非测试时设定为0测试时设定为1.测试状态下会很多对话框监视状态
  17. var isDebug = 0;
  18. //上次签到日期
  19. var lastSign = new Date();
  20. var lastSignStr;
  21. var vTemp = GM_getValue('lastSign');
  22. if (vTemp) {
  23. var y = vTemp.match(/(\d+)y/) [1];
  24. var m = vTemp.match(/(\d+)m/) [1];
  25. var d = vTemp.match(/(\d+)d/) [1];
  26. lastSign.setFullYear(y, m, d);
  27. } else {
  28. lastSign.setFullYear(1970, 0, 1);
  29. }
  30. lastSignStr = lastSign.getFullYear() + 'y' + lastSign.getMonth() + 'm' + lastSign.getDate() + 'd';
  31. //油猴菜单
  32. GM_registerMenuCommand('一键签到', SimpleSign);
  33. /*所有需要签到的网站的资料
  34. sType代表网站类型,目前只有simple和formhash两种.simple只要直接签到,formhash的比较复杂,要先访问主页获取formhash*/
  35. var webSite = [
  36. {
  37. sType: 'formhash',
  38. data: 'qdxq=kx',
  39. signURL: 'https://sstmlt.net/plugin.php?id=dsu_paulsign:sign&operation=qiandao&infloat=1&sign_as=1&inajax=1',
  40. homeURL: 'https://sstmlt.net'
  41. },
  42. {
  43. sType: 'simple',
  44. data: '',
  45. signURL: 'http://www.lightnovel.cn/home.php?mod=task&do=apply&id=98'
  46. },
  47. {
  48. sType: 'simple',
  49. data: '',
  50. signURL: 'http://bbs4.2djgame.net/home/home.php?mod=task&do=apply&id=1'
  51. },
  52. {
  53. sType: 'simple',
  54. data: '',
  55. signURL: 'http://www.acfun.tv/member/checkin.aspx'
  56. }
  57. ];
  58. //一键签到命令
  59. function SimpleSign() {
  60. //今天的日期
  61. var today = new Date();
  62. var todayStr = today.getFullYear() + 'y' + today.getMonth() + 'm' + today.getDate() + 'd';
  63. //DebugAlert('日期差=' + (today - lastSign));
  64. if (lastSignStr == todayStr) {
  65. if (!confirm('今天已经运行过一键签到,一定要再运行吗?')) {
  66. DebugAlert('放弃再运行');
  67. return;
  68. } else {
  69. DebugAlert('执意再运行');
  70. }
  71. } else {
  72. DebugAlert('第一次执行当日一键签到');
  73. }
  74. //DebugAlert('lastSign='+lastSignStr);
  75. //DebugAlert('today='+todayStr);
  76. //DebugAlert('共有'+webSite.length+'个网站需要签到');
  77.  
  78. for (var i = 0; i < webSite.length; i++) {
  79. if (webSite[i].sType == 'simple') {
  80. //DebugAlert('抓到一只simple的URL'+webSite[i].signURL);
  81. GM_xmlhttpRequest({
  82. method: 'GET',
  83. url: webSite[i].signURL,
  84. headers: {
  85. 'User-Agent': 'Mozilla/5.0',
  86. 'Accept': 'text/xml',
  87. 'Content-Type': 'application/x-www-form-urlencoded'
  88. },
  89. onload: function (response) {
  90. // alert(response.responseText.match('本期您已申请过'));
  91. DebugAlert(response.responseText);
  92. }
  93. });
  94. }
  95. if (webSite[i].sType == 'formhash') {
  96. //DebugAlert('抓到一只formhash的URL'+webSite[i].signURL);
  97. var signURL=webSite[i].signURL;
  98. var data=webSite[i].data;//要把变量传到响应函数,需要在最接近的地方定义变量,否则全局变量无法传入响应函数
  99. GM_xmlhttpRequest({
  100. method: 'GET',
  101. url: webSite[i].homeURL,
  102. headers: {
  103. 'User-Agent': 'Mozilla/5.0',
  104. 'Accept': 'text/xml',
  105. 'Content-Type': 'application/x-www-form-urlencoded'
  106. },
  107. onload: function (response) {
  108. var sp_html = '';
  109. if (response) {
  110. sp_html = response.responseText;
  111. }
  112. DebugAlert('此formhash主页响应了'+response.responseText.length+'字');
  113. var formhash = sp_html.match(/formhash=([^"]*)"/) [1];
  114. if (formhash.length > 0) {
  115. DebugAlert('formhash='+formhash);
  116. //签到请求
  117. GM_xmlhttpRequest({
  118. method: 'POST',
  119. url: signURL,
  120. data: 'formhash=' + formhash + '&'+data,
  121. headers: {
  122. 'User-Agent': 'Mozilla/5.0', // If not specified, navigator.userAgent will be used.
  123. 'Accept': 'text/xml', // If not specified, browser defaults will be used.
  124. "Content-Type": "application/x-www-form-urlencoded"
  125. },
  126. onload: function (response) {
  127. DebugAlert(response.responseText);
  128. }
  129. });
  130. }
  131. }
  132. });
  133. }
  134. }
  135. //一键签到完毕,记录最近签到日期
  136.  
  137. GM_setValue('lastSign', todayStr);
  138. lastSign = new Date();
  139. lastSignStr = todayStr;
  140. alert('一键签到完成!');
  141. }
  142. //只有在debug时才显示的消息
  143.  
  144. function DebugAlert(message) {
  145. if (isDebug > 0) {
  146. alert(message);
  147. }
  148. }

QingJ © 2025

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