Retwitter

Auto follow script for Twitter (Made for secretnoye casino)

  1. // ==UserScript==
  2. // @name Retwitter
  3. // @description Auto follow script for Twitter (Made for secretnoye casino)
  4. // @version 0.0.2
  5. // @author Deps
  6. // @match https://twitter.com/*
  7. // @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
  8. // @grant none
  9. // @namespace https://gf.qytechs.cn/users/791270
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. let enabled = false;
  16. let followCount = 0;
  17. let intervalId;
  18. let quietMode = false;
  19.  
  20. const panelHtml = `
  21. <div style="position: fixed; bottom: 50px; right: 50px; z-index: 9999; background: white; padding: 10px; border-radius: 5px; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);">
  22. <div style="display: flex; justify-content: space-between; align-items: center;">
  23. <div>
  24. <span style="font-weight: bold;">Retwitter</span>
  25. <span>Following: <span id="follow-count">${followCount}</span></span>
  26. </div>
  27. <div>
  28. <label style="display: inline-flex; align-items: center;">
  29. <input type="checkbox" id="enable-checkbox" ${enabled ? 'checked' : ''} style="margin-right: 5px;">
  30. <span>Enabled</span>
  31. </label>
  32. <button id="close-button" style="border: none; background: none; font-size: 20px; cursor: pointer;">&times;</button>
  33. </div>
  34. </div>
  35. </div>
  36. `;
  37.  
  38. function clickFollowButtons() {
  39. if (!quietMode) {
  40. const followButtons = document.querySelectorAll('div[aria-label^="Follow"] span span');
  41. followButtons.forEach((button) => {
  42. if (button.textContent === 'Follow') {
  43. button.click();
  44. followCount++;
  45. document.querySelector('#follow-count').textContent = followCount;
  46. handleFollowLimit();
  47. }
  48. });
  49. } else if (quietMode) {
  50. const followButtons = document.querySelectorAll('div[aria-label^="Follow"] span span');
  51. followButtons.forEach((button) => {
  52. if (button.textContent === 'Follow') {
  53. button.click();
  54. handleFollowLimit();
  55. }
  56. });
  57. }
  58. }
  59.  
  60. function toggleScript() {
  61. enabled = !enabled;
  62. document.querySelector('#enable-checkbox').checked = enabled;
  63. if (enabled) {
  64. intervalId = setInterval(clickFollowButtons, 5000);
  65. clickFollowButtons()
  66. } else {
  67. clearInterval(intervalId);
  68. }
  69. }
  70.  
  71. function createPanel() {
  72. const panel = document.createElement('div');
  73. panel.innerHTML = panelHtml;
  74. document.body.appendChild(panel);
  75.  
  76. document.querySelector('#enable-checkbox').addEventListener('change', toggleScript);
  77. document.querySelector('#close-button').addEventListener('click', () => {
  78. panel.style.display = 'none';
  79. });
  80. }
  81.  
  82. function handleFollowLimit() {
  83. let consecutiveFailures = 0;
  84. const checkInterval = setInterval(() => {
  85. const errorBanner = document.querySelector('div[aria-label^="You are unable to follow more people at this time."] span span');
  86. if (errorBanner) {
  87. clearInterval(checkInterval);
  88. quietMode = true;
  89. document.querySelector('#follow-count').textContent = followCount + ' (quiet mode)';
  90. setInterval(clickFollowButtons, 180000);
  91. } else if (consecutiveFailures >= 3) {
  92. clearInterval(checkInterval);
  93. quietMode = true;
  94. document.querySelector('#follow-count').textContent = followCount + ' (quiet mode)';
  95. setInterval(clickFollowButtons, 180000);
  96. }
  97. else {
  98. fetch('/i/api/1.1/friendships/create.json', {method: 'POST'})
  99. .then(response => {
  100. if (!response.ok) {
  101. consecutiveFailures++;
  102. } else {
  103. consecutiveFailures = 0;
  104. }
  105. });
  106. }
  107. }, 1000);
  108. }
  109.  
  110.  
  111. function init() {
  112. createPanel();
  113. }
  114.  
  115. init();
  116. })();

QingJ © 2025

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