DropGalaxy Auto Skip

Auto skip ads and auto download on DropGalaxy

当前为 2024-05-09 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name DropGalaxy Auto Skip
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.4.1
  5. // @description Auto skip ads and auto download on DropGalaxy
  6. // @author kleptomaniac14
  7. // @match https://dropgalaxy.com/*
  8. // @match https://dropgalaxy.co/*
  9. // @match https://financemonk.net/*
  10. // @icon https://www.google.com/s2/favicons?domain=dropgalaxy.com
  11. // @grant none
  12. // @license GNU GPLv2
  13. // ==/UserScript==
  14.  
  15. // Setting esversion to 11 to use optional chaining.
  16. /* jshint esversion: 11 */
  17.  
  18. (function () {
  19. "use strict";
  20.  
  21. // Constants
  22. const MAX_IDENTIFICATION_RETRIES = 100;
  23. const CAPTCHA_CONTAINER_ID = "cfcaptcha";
  24. const ENABLE_EXPT_CODE = false;
  25.  
  26. // Global Variables
  27. let identificationRetries = 0;
  28.  
  29. // Utils
  30. const log = (message) => console.log(`[DropGalaxy Auto Skip] ${message}`);
  31.  
  32. // This code is used by the site to trigger the CAPTCHA
  33. const siteCaptchaCode = () => {
  34. turnstile.ready(function () {
  35. turnstile.render(`#${CAPTCHA_CONTAINER_ID}`, {
  36. sitekey: '0x4AAAAAAAYwfzxMEjmxM8RT',
  37. callback: function (token) {
  38. $('#tokennstatus').html('<small>being verified pls wait..</small>');
  39. bangbang(token);
  40. console.log(`Challenge Success ${token}`);
  41. },
  42. });
  43. });
  44. }
  45.  
  46. // One Time Setup
  47. log("DropGalaxy Script Loaded");
  48.  
  49. // Page Handlers
  50. const handlePage1 = () => {
  51. log("Handling Page 1");
  52.  
  53. // Click on Download Button
  54. const downloadBtn = document.getElementById("method_free");
  55. downloadBtn.click();
  56. };
  57.  
  58. const handlePage3 = () => {
  59. log("Handling Page 3");
  60.  
  61. // Click on Download Button
  62. const downloadForm = document.getElementById("dllink");
  63. const url = downloadForm.action;
  64. // Add element to show the DDL
  65. const ddlElement = document.createElement("a");
  66. ddlElement.href = url;
  67. ddlElement.innerText = "Direct Download Link";
  68. ddlElement.className = "btn btn-block btn-lg btn-primary";
  69. ddlElement.style = "background: #22a76d; color: white; margin-bottom: 20px; padding-inline: 0; border: none;";
  70. const loader = document.getElementById("load");
  71. loader.parentElement.insertBefore(ddlElement, loader)
  72.  
  73. // Auto download by opening the link
  74. window.location.assign(url);
  75. };
  76.  
  77. const handlePage2 = () => {
  78. log("Handling Page 2");
  79.  
  80. const falseDownloadBtn = document.getElementById("downloadbtn");
  81. const tokenStatus = document.getElementById("tokennstatus");
  82. const countdown = document.getElementById("countdown");
  83.  
  84. // Keep clicking until enabled
  85. const downloadIntervalId = setInterval(() => {
  86. if (tokenStatus.innerText === "click on- verify you are human..." &&
  87. countdown.style.display === 'none') {
  88. // In case CAPTCHA was not triggered by site, trigger it
  89. // manually.
  90. // This is required when site does not trigger the CAPTCHA if
  91. // it is triggered too many times or a download is going on.
  92. if (ENABLE_EXPT_CODE) {
  93. siteCaptchaCode();
  94. }
  95. } else if (
  96. // If download button is enabled and CAPTCHA is solved, submit the form
  97. tokenStatus.innerText === "ready! click on create download link" &&
  98. falseDownloadBtn.disabled === false
  99. ) {
  100. log("Download Button Enabled, submitting form");
  101. // downloadBtn.click();
  102. document.getElementById("ff1").submit();
  103. clearInterval(downloadIntervalId);
  104. }
  105. }, 500);
  106. };
  107.  
  108. const handlePage = (pageWatcherIntervalId) => {
  109. const page1Identifier = document.getElementById("method_free");
  110. const page2Identifier = document.getElementById("countdown");
  111. const page3Identifier = document.getElementById("dllink");
  112.  
  113. const adblockPageIdentifier = document.querySelector(
  114. "body > div.container.pt-5.page.message > div > div > div"
  115. );
  116. const isAdblockPage =
  117. adblockPageIdentifier?.innerText === "\nAdblock Detected!";
  118.  
  119. // If page is recognized, clear the interval to stop checking
  120. if (
  121. pageWatcherIntervalId &&
  122. (page1Identifier ||
  123. page2Identifier ||
  124. page3Identifier ||
  125. isAdblockPage)
  126. ) {
  127. log("Page Identified, stopping page watcher");
  128. clearInterval(pageWatcherIntervalId);
  129. // identificationRetries = 0;
  130. // no need to reset retries, as it will be reset on next page load
  131. }
  132.  
  133. if (page1Identifier) {
  134. handlePage1();
  135. } else if (page2Identifier) {
  136. handlePage2();
  137. } else if (page3Identifier) {
  138. handlePage3();
  139. } else if (isAdblockPage) {
  140. // handleAdblockPage();
  141. // Not implemented
  142. } else if (MAX_IDENTIFICATION_RETRIES > identificationRetries) {
  143. log("Unknown Page or Waiting for identification");
  144. identificationRetries++;
  145. } else {
  146. log("Max Identification Retries Reached, Stopping Page Watcher");
  147. clearInterval(pageWatcherIntervalId);
  148. }
  149. };
  150.  
  151. // Keep checking the page as soon as it loads
  152. let intervalId = setInterval(() => {
  153. handlePage(intervalId);
  154. }, 500);
  155. })();