PTC 2 2023

Multi PTC Cryptorotator

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/457166/1131998/PTC%202%202023.js

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