PTC 1 2023

Multi WEB AutoRotasi

当前为 2022-12-26 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/457103/1132000/PTC%201%202023.js

  1. // ==UserScript==
  2. // @name PTC 1 2023
  3. // @namespace Multi WEB PTC With Manual Captcha
  4. // @version 1.0
  5. // @description Multi WEB AutoRotasi
  6. // @author Saputra
  7. // @match viefaucet.com/*
  8. // @match https://gwaher.com/*
  9. // @match https://earnsato.com/*
  10. // @connect earnsato.com
  11. // @connect viefaucet.com
  12. // @connect gwaher.com
  13. // @license MIT
  14. // @grant GM_xmlhttpRequest
  15. // @grant GM_setValue
  16. // @grant GM_getValue
  17.  
  18. // ==/UserScript==
  19. (function() {
  20.  
  21. 'use strict';
  22. window.alert = function() {};
  23. window.confirm = function() {};
  24.  
  25.  
  26. //Do not execute if window is a pop up
  27. if(window.name){
  28. return;
  29. }
  30.  
  31. var count = 0;
  32. var clicked = false;
  33.  
  34.  
  35. //Enter your login and password below, if you like to Autologin. Be careful while providing passwords,
  36. //else you may get your accounts locked
  37. var websiteData = [
  38. {url : "https://viefaucet.com/app/ptc", login: "", password: ""},
  39. {url : "https://gwaher.com/ptc", login: "", password: ""},
  40. {url : "https://earnsato.com/user/ptc", login: "", password: ""},
  41.  
  42. ];
  43.  
  44. var websiteMap = [{
  45.  
  46. website: ["viefaucet.com"],
  47. defaultButtonSelectors: [".el-card__body .el-button.el-button--primary.claim-button"],
  48. allMessageSelectors: [".el-notification__group",".el-notification__content"],
  49. messagesToCheckBeforeMovingToNextUrl: ["You have claimed 21 tokens", "You have claimed 50 tokens", "You have claimed 91 tokens", "You have claimed 20 tokens", "Success"],
  50. timeoutbeforeMovingToNextUrl: 40000
  51. },
  52.  
  53. {
  54. website: ["gwaher.com"],
  55. defaultButtonSelectors: [".divgc.card-body .button-33"],
  56. timeoutbeforeMovingToNextUrl: 50000
  57. },
  58.  
  59. {
  60. website: ["earnsato.com"],
  61. defaultButtonSelectors: [".card-body.p-4 .btn.fs--12px.px-sm-3.px-2.py-1.btn--base.mt-2"],
  62. allMessageSelectors: [".text-center.text--base"],
  63. messagesToCheckBeforeMovingToNextUrl: ["No More Available Ads, Come back later!"],
  64. timeoutbeforeMovingToNextUrl: 45000
  65. },
  66.  
  67.  
  68. ];
  69.  
  70.  
  71. //HtmlEvents dispatcher
  72. function triggerEvent(el, type) {
  73. try{
  74. var e = document.createEvent('HTMLEvents');
  75. e.initEvent(type, false, true);
  76. el.dispatchEvent(e);
  77. }catch(exception){
  78. console.log(exception);
  79. }
  80. }
  81.  
  82. function toggleCaptcha(selector, index){
  83. if( document.querySelector(selector)){
  84. document.querySelector(selector).selectedIndex = index;
  85. var targetNode = document.querySelector(selector);
  86. if (targetNode) {
  87. setTimeout(function() {
  88. triggerEvent(targetNode, 'change');
  89. }, 5000);
  90. }
  91. }
  92. }
  93.  
  94. //Check if a string is present in Array
  95. String.prototype.includesOneOf = function(arrayOfStrings) {
  96.  
  97. //If this is not an Array, compare it as a String
  98. if (!Array.isArray(arrayOfStrings)) {
  99. return this.toLowerCase().includes(arrayOfStrings.toLowerCase());
  100. }
  101.  
  102. for (var i = 0; i < arrayOfStrings.length; i++) {
  103. if (this.toLowerCase().includes(arrayOfStrings[i].toLowerCase())) {
  104. return true;
  105. }
  106. }
  107. return false;
  108. }
  109.  
  110. var websiteDataValues = {};
  111.  
  112. //Get selector details from the websiteMap
  113. for (let value of Object.values(websiteMap)) {
  114. if (window.location.href.includesOneOf(value.website)) {
  115. websiteDataValues.inputTextSelector = value.inputTextSelector;
  116. websiteDataValues.inputTextSelectorButton = value.inputTextSelectorButton;
  117. websiteDataValues.defaultButtonSelectors = value.defaultButtonSelectors;
  118. websiteDataValues.claimButtonSelector = value.claimButtonSelector;
  119. websiteDataValues.captchaButtonSubmitSelector = value.captchaButtonSubmitSelector;
  120. websiteDataValues.loginSelectors = value.loginSelectors;
  121. websiteDataValues.loginCaptcha = value.loginCaptcha;
  122. websiteDataValues.allMessageSelectors = value.allMessageSelectors;
  123. websiteDataValues.messagesToCheckBeforeMovingToNextUrl = value.messagesToCheckBeforeMovingToNextUrl;
  124. websiteDataValues.withdrawPageUrl = value.withdrawPageUrl;
  125. websiteDataValues.withdrawEnabled = value.withdrawEnabled;
  126. websiteDataValues.balanceSelector = value.balanceSelector;
  127. websiteDataValues.withdrawMinAmount = value.withdrawMinAmount;
  128. websiteDataValues.successMessageSelectors = value.successMessageSelectors;
  129. websiteDataValues.toggleCaptchaSelector = value.toggleCaptchaSelector;
  130. websiteDataValues.toggleCaptchaSelectorIndex = value.toggleCaptchaSelectorIndex;
  131. websiteDataValues.additionalFunctions = value.additionalFunctions;
  132. websiteDataValues.timeoutbeforeMovingToNextUrl = value.timeoutbeforeMovingToNextUrl;
  133. break;
  134. }
  135. }
  136.  
  137.  
  138. var login = "";
  139. var password = "";
  140.  
  141. for (let value of Object.values(websiteData)) {
  142. count = count + 1;
  143. if (value.url.includes(window.location.hostname)) {
  144. websiteDataValues.url = value.url;
  145. login = value.login;
  146. password = value.password;
  147. break;
  148. }
  149. }
  150.  
  151.  
  152. //Get the next Url from the website data map
  153. async function getNextUrl() {
  154.  
  155. //Go to the beginning if the end of the array is reached
  156. if (count >= websiteData.length) {
  157. websiteDataValues.nextUrl = websiteData[0].url;
  158. } else {
  159. websiteDataValues.nextUrl = websiteData[count].url;
  160. }
  161.  
  162. //Use case for overrding next Url
  163. if (websiteDataValues.overrideNextUrl) {
  164. websiteDataValues.nextUrl = websiteDataValues.overrideNextUrl;
  165. }
  166.  
  167. //Ping Test to check if a website is up before proceeding to next url
  168. pingTest(websiteDataValues.nextUrl);
  169. }
  170.  
  171. var isNextUrlReachable = false;
  172. //Get the next Url from the website
  173. function pingTest(websiteUrl) {
  174. console.log(websiteUrl);
  175. GM_xmlhttpRequest({
  176. method: "GET",
  177. url: websiteUrl,
  178. headers: {
  179. "Content-Type": "application/x-www-form-urlencoded"
  180. },
  181. timeout: 5000,
  182. onload: function(response) {
  183. //Website is reachable
  184. isNextUrlReachable = true;
  185. },
  186. onerror: function(e) {
  187. count = count + 1;
  188. getNextUrl();
  189. },
  190. ontimeout: function() {
  191. count = count + 1;
  192. getNextUrl();
  193. },
  194. });
  195.  
  196. }
  197.  
  198.  
  199. async function delay(ms) {
  200. return new Promise(resolve => setTimeout(resolve, ms))
  201. }
  202.  
  203.  
  204. var movingToNextUrl = false;
  205. async function goToNextUrl() {
  206. if (!movingToNextUrl) {
  207. movingToNextUrl = true;
  208. getNextUrl();
  209. while (!isNextUrlReachable) {
  210. await delay(3000);
  211. }
  212. window.location.href = websiteDataValues.nextUrl;
  213. }
  214. }
  215.  
  216.  
  217. //Default Setting: After 180 seconds go to next Url
  218. var delayBeforeMovingToNextUrl = 180000;
  219. if (websiteDataValues.timeoutbeforeMovingToNextUrl) {
  220. delayBeforeMovingToNextUrl = websiteDataValues.timeoutbeforeMovingToNextUrl;
  221. }
  222.  
  223. setTimeout(function() {
  224. goToNextUrl();
  225. }, delayBeforeMovingToNextUrl);
  226.  
  227.  
  228. //Wait for 5 seconds if it's in dashboard,
  229. if ((!window.location.href.includes("coinpayu")) && (window.location.href.includes("dashboard") || window.location.href.includes("page/user-admin"))) {
  230. setTimeout(function() {
  231. if (websiteDataValues.url) {
  232. window.location.href = websiteDataValues.url;
  233. }
  234. }, 5000);
  235. }
  236.  
  237.  
  238. //Returns true if message selectors are present
  239. function messageSelectorsPresent() {
  240. if (websiteDataValues.allMessageSelectors) {
  241. for (var j = 0; j < websiteDataValues.allMessageSelectors.length; j++) {
  242. for (var k = 0; k < document.querySelectorAll(websiteDataValues.allMessageSelectors[j]).length; k++) {
  243. if (document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k] &&
  244. (document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k].innerText.includesOneOf(websiteDataValues.messagesToCheckBeforeMovingToNextUrl) ||
  245. (document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k].value &&
  246. document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k].value.includesOneOf(websiteDataValues.messagesToCheckBeforeMovingToNextUrl)))) {
  247. return true;
  248. }
  249. }
  250. }
  251. }
  252. return false;
  253. }
  254.  
  255. function closeRepeatingAds() {
  256.  
  257. //Check if previous Ad is Same as Current Ad and Skip the Ad
  258. if (unsafeWindow.viewurl) {
  259. if (GM_getValue("adUrl") && GM_getValue("adUrl") == unsafeWindow.viewurl) {
  260. //Skip the Ad
  261. document.querySelector(".card > a").click();
  262. movingToNextUrl = true;
  263. } else {
  264. GM_setValue("adUrl", unsafeWindow.viewurl);
  265. }
  266.  
  267. }
  268.  
  269. }
  270.  
  271.  
  272. function bithub() {
  273.  
  274. //Block Pop Ups
  275. unsafeWindow.open = function(){};
  276.  
  277. if(document.querySelector("body").innerText.includes("This ad does not exist or has expired")){
  278. window.location.href = "https://bithub.win/ptc/";
  279. }
  280.  
  281. }
  282.  
  283. function dogemate() {
  284.  
  285. //Block Pop Ups
  286. unsafeWindow.open = function(){};
  287.  
  288. if(document.querySelector("body").innerText.includes("This ad does not exist or has expired")){
  289. window.location.href = "https://dogemate.com/ptc/";
  290. }
  291.  
  292. }
  293.  
  294. function bits() {
  295.  
  296. //Block Pop Ups
  297. unsafeWindow.open = function(){};
  298.  
  299. if(document.querySelector("body").innerText.includes("This ad does not exist or has expired")){
  300. window.location.href = "https://bits.re/ptc/";
  301. }
  302.  
  303. }
  304.  
  305.  
  306.  
  307. function mad() {
  308.  
  309. //Block Pop Ups
  310. unsafeWindow.open = function(){};
  311.  
  312. if(document.querySelector("body").innerText.includes("This ad does not exist or has expired")){
  313. window.location.href = ["https://coinpayz.xyz/ptc/","https://coinpot.in/ptc/"];
  314. }
  315.  
  316. }
  317.  
  318.  
  319. var stopSolvingCaptcha = false;
  320.  
  321. function checkLoginSelectors() {
  322.  
  323. if (websiteDataValues.loginSelectors) {
  324. //Check if all login selectors are present
  325. let count = 0;
  326. for (let i = 0; i < websiteDataValues.loginSelectors.length; i++) {
  327. if (document.querySelector(websiteDataValues.loginSelectors[i])) {
  328. count++;
  329. }
  330.  
  331. }
  332.  
  333. if (count == websiteDataValues.loginSelectors.length) {
  334.  
  335. if (login.length > 0 && password.length > 0) {
  336. //Input Login
  337. document.querySelector(websiteDataValues.loginSelectors[0]).value = login;
  338.  
  339. //Input Password
  340. document.querySelector(websiteDataValues.loginSelectors[1]).value = password;
  341. } else {
  342. stopSolvingCaptcha = true;
  343. }
  344.  
  345. } else {
  346. stopSolvingCaptcha = true;
  347. }
  348.  
  349. } else {
  350. stopSolvingCaptcha = true;
  351. }
  352.  
  353. }
  354.  
  355.  
  356. setTimeout(function() {
  357.  
  358. checkLoginSelectors();
  359.  
  360. if (websiteDataValues.additionalFunctions) {
  361. websiteDataValues.additionalFunctions();
  362. }
  363.  
  364. //Look for all the default messages or errors before proceeding to next url
  365. //For other languages difference in the length of the strings can be compared or visibility of the style element
  366. if (!movingToNextUrl && messageSelectorsPresent()) {
  367. goToNextUrl();
  368. }
  369.  
  370.  
  371. //Check for all the default button selectors and click
  372. //This will only click the first selector found, so mention the selectors with parent element wherever required
  373. if(!movingToNextUrl && websiteDataValues.defaultButtonSelectors){
  374. for(var i=0;i<websiteDataValues.defaultButtonSelectors.length ;i++){
  375. if(document.querySelector(websiteDataValues.defaultButtonSelectors[i])){
  376. triggerEvent(document.querySelector(websiteDataValues.defaultButtonSelectors[i]), 'mousedown');
  377. triggerEvent(document.querySelector(websiteDataValues.defaultButtonSelectors[i]), 'mouseup');
  378. document.querySelector(websiteDataValues.defaultButtonSelectors[i]).click();
  379. break;
  380. }
  381. }
  382. }
  383.  
  384. if(!movingToNextUrl && websiteDataValues.toggleCaptchaSelector && Number.isInteger(websiteDataValues.toggleCaptchaSelectorIndex)){
  385. toggleCaptcha(websiteDataValues.toggleCaptchaSelector,websiteDataValues.toggleCaptchaSelectorIndex);
  386. }
  387.  
  388. //Input the address and click the login button
  389. if (!movingToNextUrl && document.querySelector(websiteDataValues.inputTextSelector)) {
  390. document.querySelector(websiteDataValues.inputTextSelector).value = websiteDataValues.address;
  391. setTimeout(function() {
  392. if (websiteDataValues.inputTextSelectorButton && document.querySelector(websiteDataValues.inputTextSelectorButton)) {
  393. document.querySelector(websiteDataValues.inputTextSelectorButton).click();
  394. }
  395.  
  396. }, 5000);
  397. }
  398.  
  399. //Click the form button after solving captcha
  400. //Works for both recaptcha and hcaptcha
  401. var clicked = false;
  402. var captchaInterval = setInterval(function() {
  403. if (!stopSolvingCaptcha || !window.location.href.includes("login")) {
  404. try {
  405. if (!clicked && unsafeWindow.grecaptcha && unsafeWindow.grecaptcha.getResponse().length > 0) {
  406. for (let i = 0; i < websiteDataValues.captchaButtonSubmitSelector.length; i++) {
  407. if (document.querySelector(websiteDataValues.captchaButtonSubmitSelector[i])) {
  408. document.querySelector(websiteDataValues.captchaButtonSubmitSelector[i]).click();
  409. }
  410. }
  411. clicked = true;
  412.  
  413. clearInterval(captchaInterval);
  414. setTimeout(function() {
  415. if (messageSelectorsPresent()) {
  416. goToNextUrl();
  417. }
  418. }, 5000);
  419. }
  420. } catch (e) {
  421.  
  422. }
  423.  
  424. for (var hc = 0; hc < document.querySelectorAll("iframe").length; hc++) {
  425. if (!clicked && document.querySelectorAll("iframe")[hc] &&
  426. document.querySelectorAll("iframe")[hc].getAttribute("data-hcaptcha-response") &&
  427. document.querySelectorAll("iframe")[hc].getAttribute("data-hcaptcha-response").length > 0) {
  428. for (let i = 0; i < websiteDataValues.captchaButtonSubmitSelector.length; i++) {
  429. if (document.querySelector(websiteDataValues.captchaButtonSubmitSelector[i])) {
  430. document.querySelector(websiteDataValues.captchaButtonSubmitSelector[i]).click();
  431. }
  432. }
  433. clicked = true;
  434. clearInterval(captchaInterval);
  435. setTimeout(function() {
  436. if (messageSelectorsPresent()) {
  437. goToNextUrl();
  438. }
  439. }, 5000);
  440. }
  441. }
  442. }
  443.  
  444. }, 5000);
  445.  
  446.  
  447. }, 5000);
  448.  
  449.  
  450. window.onbeforeunload = function() {
  451. if (unsafeWindow.myWindow) {
  452. unsafeWindow.myWindow.close();
  453. }
  454. if (unsafeWindow.coinwin) {
  455. var tmp = unsafeWindow.coinwin;
  456. unsafeWindow.coinwin = {};
  457. tmp.close();
  458. }
  459.  
  460. };
  461.  
  462. })();