Faucet Rotator - Crypto Magy

Earn free crypto using this script instantly

当前为 2024-01-21 提交的版本,查看 最新版本

在您安装前,Greasy Fork 希望您知道此脚本声明其包含了一些负面功能。这些功能也许会使脚本作者获利,而不能给您带来任何直接的金钱收益。

作者可从这份脚本获得佣金,例如通过修改链接地址或提供优惠券代码以包含推荐或附属代码。

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Faucet Rotator - Crypto Magy
// @namespace    Faucet Rotator - Crypto Magy
// @version      1.5
// @description  Earn free crypto using this script instantly
// @author       BleemV
// @match        https://cryptomagy.com/*
// @connect      cryptomagy.com
// @icon         https://www.google.com/s2/favicons?sz=64&domain=cryptomagy.com
// @noframes
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_xmlhttpRequest
// @antifeature  referral-link
// ==/UserScript==

//Block All Pop ups
unsafeWindow.open = function() { };

(function() {
	'use strict';

	//===============================================================================================
	//User configuration

	var faucetpayEmail = "ENTER_YOUR_FAUCETPAY_EMAIL_ADDRESS";
	var btc = "ENTER_YOUR_FAUCETPAY_BITCOIN_ADDRESS";
	var doge = "ENTER_YOUR_FAUCETPAY_DOGE_ADDRESS";
	var ltc = "ENTER_YOUR_FAUCETPAY_LITECOIN_ADDRESS";
	var trx = "ENTER_YOUR_FAUCETPAY_TRON_ADDRESS";
	var bnb = "ENTER_YOUR_FAUCETPAY_BINANCE_ADDRESS";
	var sol = "ENTER_YOUR_FAUCETPAY_SOLANA_ADDRESS";
	var usdt = "ENTER_YOUR_FAUCETPAY_TETHER_ADDRESS";
	var ada = "ENTER_YOUR_FAUCETPAY_CARDANO_ADDRESS";
	var matic = "ENTER_YOUR_FAUCETPAY_POLYGON_ADDRESS";
	var eth = "ENTER_YOUR_FAUCETPAY_ETHEREUM_ADDRESS";
	var bch = "ENTER_YOUR_FAUCETPAY_BITCOINCASH_ADDRESS";
	var dash = "ENTER_YOUR_FAUCETPAY_DASH_ADDRESS";
	var zec = "ENTER_YOUR_FAUCETPAY_ZCASH_ADDRESS";
	var dgb = "ENTER_YOUR_FAUCETPAY_DIGIBYTE_ADDRESS";

	//You can now save the file and start using
	//===============================================================================================

	//List of the faucet websites along with address
	//coin parameter is used as regex from the url
	//If url has */bitcoin/* then use "bitcoin" as coin, if it is */ETH/*, use "ETH" as coin
	//If there is no regex for coin, use only address
	// Comment the faucets which you do not wish to use or which don't have sufficient funds
	// Always add bitcoin before bitcoincash if you using same domains

	var websiteData = [
		{ url: "https://cryptomagy.com/bitcoin-faucet/[email protected]", coin: "bitcoin-faucet", address: faucetpayEmail },
		{ url: "https://cryptomagy.com/dogecoin-faucet/[email protected]", coin: "dogecoin-faucet", address: faucetpayEmail },
		{ url: "https://cryptomagy.com/litecoin-faucet/[email protected]", coin: "litecoin-faucet", address: faucetpayEmail },
		{ url: "https://cryptomagy.com/tron-faucet/[email protected]", coin: "tron-faucet", address: faucetpayEmail },
		{ url: "https://cryptomagy.com/bnb-faucet/[email protected]", coin: "bnb-faucet", address: faucetpayEmail },
		{ url: "https://cryptomagy.com/solana-faucet/[email protected]", coin: "solana-faucet", address: faucetpayEmail },
		{ url: "https://cryptomagy.com/tether-faucet/[email protected]", coin: "tether-faucet", address: faucetpayEmail },
		{ url: "https://cryptomagy.com/cardano-faucet/[email protected]", coin: "cardano-faucet", address: faucetpayEmail },
		{ url: "https://cryptomagy.com/ripple-faucet/[email protected]", coin: "ripple-faucet", address: faucetpayEmail },
		{ url: "https://cryptomagy.com/polygon-faucet/[email protected]", coin: "polygon-faucet", address: faucetpayEmail },
		{ url: "https://cryptomagy.com/ethereum-faucet/[email protected]", coin: "ethereum-faucet", address: faucetpayEmail },
		{ url: "https://cryptomagy.com/bch-faucet/[email protected]", coin: "bch-faucet", address: faucetpayEmail },
		{ url: "https://cryptomagy.com/dash-faucet/?r=XhMLuGgsBigfNQgdCYUKYjn7H1sVmGbc32", coin: "dash-faucet", address: faucetpayEmail },
		{ url: "https://cryptomagy.com/zcash-faucet/[email protected]", coin: "zcash-faucet", address: faucetpayEmail },
		{ url: "https://cryptomagy.com/digibyte-faucet/[email protected]", coin: "digibyte-faucet", address: faucetpayEmail },
	];

	//Add data for any new website with single pages
	//Message selectors are for success or failure to move on to the next website
	//AutoWithdraw is disabled by default(for bagi and keran)
	//Add only domain name in website as mentioned below. Follow the same pattern.
	//Use arrays wherever it is required
	//ToDo:Instead of reading messages, either visibility or length of the messages can be checked

	var websiteMap = [{
		website: ["cryptomagy.com"],
		inputTextSelector: ["#address"],
		inputTextSelectorButton: ["body > div.container.flex-grow.my-4 > div.row.my-2 > div.col-12.col-md-8.col-lg-8.order-md-2.mb-4.text-center > form > div:nth-child(4) > button"],
		defaultButtonSelectors: ["a.btn"],
		captchaButtonSubmitSelector: ["input[type='submit']"],
		allMessageSelectors: [".alert.alert-warning", ".alert.alert-success", ".alert.alert-danger", "#cf-error-details"],
		successMessageSelectors: [".alert.alert-success"],
		messagesToCheckBeforeMovingToNextUrl: ["invalid", "sufficient", "you have reached", "tomorrow", "wrong order", "locked", "was sent to your", "You have to wait", "Login not valid", "You have already claimed", "claimed successfully", "Claim not Valid", "rate limited"],
		ablinks: true,
	},
	];

	var ablinksSolved = false;

	//HtmlEvents dispatcher
	function triggerEvent(el, type) {
		try {
			var e = document.createEvent('HTMLEvents');
			e.initEvent(type, false, true);
			el.dispatchEvent(e);
		} catch (exception) {
			console.log(exception);
		}
	}

	//Check if a string is present in Array
	String.prototype.includesOneOf = function(arrayOfStrings) {

		//If this is not an Array, compare it as a String
		if (!Array.isArray(arrayOfStrings)) {
			return this.toLowerCase().includes(arrayOfStrings.toLowerCase());
		}

		for (var i = 0; i < arrayOfStrings.length; i++) {
			if (this.toLowerCase().includes(arrayOfStrings[i].toLowerCase())) {
				return true;
			}
		}
		return false;
	}

	var websiteDataValues = {};

	//Get selector details from the websiteMap
	for (let value of Object.values(websiteMap)) {
		if (window.location.href.includesOneOf(value.website)) {
			websiteDataValues.inputTextSelector = value.inputTextSelector;
			websiteDataValues.inputTextSelectorButton = value.inputTextSelectorButton;
			websiteDataValues.defaultButtonSelectors = value.defaultButtonSelectors;
			websiteDataValues.claimButtonSelectors = value.claimButtonSelectors;
			websiteDataValues.captchaButtonSubmitSelector = value.captchaButtonSubmitSelector;
			websiteDataValues.allMessageSelectors = value.allMessageSelectors;
			websiteDataValues.messagesToCheckBeforeMovingToNextUrl = value.messagesToCheckBeforeMovingToNextUrl;
			websiteDataValues.withdrawPageUrl = value.withdrawPageUrl;
			websiteDataValues.withdrawEnabled = value.withdrawEnabled;
			websiteDataValues.balanceSelector = value.balanceSelector;
			websiteDataValues.withdrawMinAmount = value.withdrawMinAmount;
			websiteDataValues.successMessageSelectors = value.successMessageSelectors;
			websiteDataValues.additionalFunctions = value.additionalFunctions;
			websiteDataValues.timeoutbeforeMovingToNextUrl = value.timeoutbeforeMovingToNextUrl;
			websiteDataValues.formSubmit = value.formSubmit;
			websiteDataValues.ablinks = value.ablinks;
			break;
		}
	}

	//Identify which coin to input, based on the url input
	//If the URL does not contain the coin, then use the default from the domain name
	var count = 0;
	var addressAssigned = false;
	for (let value of Object.values(websiteData)) {
		count = count + 1;
		if (value.url.includes(window.location.hostname) && (window.location.href.includes("/" + value.coin + "/") ||
			window.location.href.includes("/" + value.coin + "-") ||
			window.location.href.endsWith("/" + value.coin))) {
			websiteDataValues.address = value.address;
			addressAssigned = true;
			break;
		}
	}

	//If URL does not have coin, check the default from the domain name
	if (!addressAssigned) {
		count = 0;
		for (let value of Object.values(websiteData)) {
			count = count + 1;

			if (value.url.includes(window.location.hostname)) {
				if (value.regex) {
					if (GM_getValue("UrlRegex")) {
						if (GM_getValue("UrlRegex") == value.regex) {
							websiteDataValues.address = value.address;
							break;
						}
					} else {
						GM_setValue("UrlRegex", value.regex);
						websiteDataValues.address = value.address;
						break;
					}

				} else {
					websiteDataValues.address = value.address;
					break;
				}
			}
		}
	}



	//Get the next Url from the website data map
	async function getNextUrl() {

		//Go to the beginning if the end of the array is reached
		if (count >= websiteData.length) {
			count = 0;
		}

		websiteDataValues.nextUrl = websiteData[count].url;
		websiteDataValues.regex = websiteData[count].regex;

		//Ping Test to check if a website is up before proceeding to next url
		pingTest(websiteDataValues.nextUrl);
	}

	var isNextUrlReachable = false;
	//Get the next Url from the website
	function pingTest(websiteUrl) {
		console.log(websiteUrl);
		GM_xmlhttpRequest({
			method: "GET",
			url: websiteUrl,
			headers: {
				"Content-Type": "application/x-www-form-urlencoded"
			},
			timeout: 2000,
			onload: function(response) {
				//Website is reachable
				if (response && response.status == 200) {
					isNextUrlReachable = true;
				} else {
					count = count + 1;
					getNextUrl();
				}
			},
			onerror: function(e) {
				count = count + 1;
				getNextUrl();
			},
			ontimeout: function() {
				count = count + 1;
				getNextUrl();
			},
		});

	}


	async function delay(ms) {
		return new Promise(resolve => setTimeout(resolve, ms))
	}


	var movingToNextUrl = false;
	async function goToNextUrl() {
		if (!movingToNextUrl) {
			movingToNextUrl = true;
			getNextUrl();
			while (!isNextUrlReachable) {
				await delay(2000);
			}

			if (websiteDataValues.regex) {
				GM_setValue("UrlRegex", websiteDataValues.regex);
			}
			window.location.href = websiteDataValues.nextUrl;
			movingToNextUrl = true;
		}
	}

	async function goToWithdrawPage() {
		if (!movingToNextUrl) {
			movingToNextUrl = true;
			window.location.href = websiteDataValues.withdrawPageUrl;
		}

	}


	//Default Setting: After 180 seconds go to next Url
	var delayBeforeMovingToNextUrl = 100000;
	if (websiteDataValues.timeoutbeforeMovingToNextUrl) {
		delayBeforeMovingToNextUrl = websiteDataValues.timeoutbeforeMovingToNextUrl;
	}

	setTimeout(function() {
		movingToNextUrl = false;
		goToNextUrl();
	}, delayBeforeMovingToNextUrl);


	//Move to next URL if address is not mentioned above
	if (window.location.href.includes("to=FaucetPay") || (websiteDataValues.address) && (websiteDataValues.address.length < 5 || websiteDataValues.address.includes("YOUR_"))) {
		goToNextUrl();
	}

	//Returns true if message selectors are present
	function messageSelectorsPresent() {
		if (websiteDataValues.allMessageSelectors) {
			for (var j = 0; j < websiteDataValues.allMessageSelectors.length; j++) {
				for (var k = 0; k < document.querySelectorAll(websiteDataValues.allMessageSelectors[j]).length; k++) {
					if (document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k] &&
						(document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k].innerText.includesOneOf(websiteDataValues.messagesToCheckBeforeMovingToNextUrl) ||
							(document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k].value &&
								document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k].value.includesOneOf(websiteDataValues.messagesToCheckBeforeMovingToNextUrl)))) {
						return true;
					}
				}
			}
		}
		return false;
	}

	//Returns true if any message is present in message selector
	function checkMessageSelectorsLength() {
		if (websiteDataValues.allMessageSelectors) {
			for (var j = 0; j < websiteDataValues.allMessageSelectors.length; j++) {
				for (var k = 0; k < document.querySelectorAll(websiteDataValues.allMessageSelectors[j]).length; k++) {
					if (document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k] &&
						(document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k].innerText.length > 0) ||
						(document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k].value &&
							document.querySelectorAll(websiteDataValues.allMessageSelectors[j])[k].value.length > 0)) {
						return true;
					}
				}
			}
		}
		return false;
	}

	//Returns true if message selectors are present
	function successMessageSelectorsPresent() {
		if (websiteDataValues.successMessageSelectors) {
			for (var j = 0; j < websiteDataValues.successMessageSelectors.length; j++) {
				for (var k = 0; k < document.querySelectorAll(websiteDataValues.successMessageSelectors[j]).length; k++) {
					if (document.querySelectorAll(websiteDataValues.successMessageSelectors[j])[k] && document.querySelectorAll(websiteDataValues.successMessageSelectors[j])[k].innerText.includesOneOf(websiteDataValues.messagesToCheckBeforeMovingToNextUrl)) {
						return true;
					}
				}
			}
		}
		return false;
	}


	function ablinksCaptcha() {

		setInterval(function() {

			if (document.querySelector("#switch") && document.querySelector("#switch").innerText.toLowerCase().includes("hcaptcha")) {
				document.querySelector("#switch").click();
			} else if (document.querySelector("#switch") && document.querySelector("#switch").innerText.toLowerCase().includes("recaptcha")) {
				document.querySelector("#switch").click();
			}
			var count = 0;

			var abModels = [".modal-content [href='/']", ".modal-body [href='/']", ".antibotlinks [href='/']"];
			var abModelsImg = [".modal-content [href='/'] img", ".modal-body [href='/'] img", ".antibotlinks [href='/'] img"];
			for (let j = 0; j < abModelsImg.length; j++) {
				if (document.querySelector(abModelsImg[j]) &&
					document.querySelector(abModelsImg[j]).value == "####") {
					goToNextUrl();
					break;
				}
			}

			for (let i = 0; i < 4; i++) {
				for (let j = 0; j < abModels.length; j++) {
					if (document.querySelectorAll(abModelsImg[j]).length == 4 &&
						document.querySelectorAll(abModels[j])[i] &&
						document.querySelectorAll(abModels[j])[i].style &&
						document.querySelectorAll(abModels[j])[i].style.display == 'none') {
						count++;
						break;
					}
				}
			}
			if (count == 4) {
				ablinksSolved = true;
			}
		}, 2000);

	}


	setTimeout(function() {

		ablinksCaptcha();


		if (window.name == "nextWindowUrl") {
			window.name = "";
			goToNextUrl();
			return;
		} else {
			window.name = window.location.href;
		}


		if (websiteDataValues.additionalFunctions) {
			websiteDataValues.additionalFunctions();
		}

		if (websiteDataValues.withdrawEnabled) {
			if (websiteDataValues.balanceSelector && document.querySelector(websiteDataValues.balanceSelector)) {
				var currentBalance = document.querySelector(websiteDataValues.balanceSelector).innerText;
				if (currentBalance > websiteDataValues.withdrawMinAmount && !window.location.href.includes(websiteDataValues.withdrawPageUrl)) {
					goToWithdrawPage();
				}

			} else {
				if (successMessageSelectorsPresent()) {
					goToWithdrawPage();
				}
			}
		}


		if (!movingToNextUrl && messageSelectorsPresent()) {
			goToNextUrl();
		}



		if (!movingToNextUrl && document.querySelector(websiteDataValues.inputTextSelector)) {
			document.querySelector(websiteDataValues.inputTextSelector).value = websiteDataValues.address;
			triggerEvent(document.querySelector(websiteDataValues.inputTextSelector), 'keypress');
			triggerEvent(document.querySelector(websiteDataValues.inputTextSelector), 'change');
			setTimeout(function() {
				if (websiteDataValues.inputTextSelectorButton && document.querySelector(websiteDataValues.inputTextSelectorButton)) {
					document.querySelector(websiteDataValues.inputTextSelectorButton).click();
				}

			}, 2000);
		}


		if (!movingToNextUrl && websiteDataValues.defaultButtonSelectors) {
			for (let i = 0; i < websiteDataValues.defaultButtonSelectors.length; i++) {
				if (document.querySelector(websiteDataValues.defaultButtonSelectors[i])) {
					triggerEvent(document.querySelector(websiteDataValues.defaultButtonSelectors[i]), 'mousedown');
					triggerEvent(document.querySelector(websiteDataValues.defaultButtonSelectors[i]), 'mouseup');
					document.querySelector(websiteDataValues.defaultButtonSelectors[i]).click();
					break;
				}
			}
		}

		setTimeout(function() {
			if (!movingToNextUrl && websiteDataValues.claimButtonSelectors) {
				for (let i = 0; i < websiteDataValues.claimButtonSelectors.length; i++) {
					if (document.querySelector(websiteDataValues.claimButtonSelectors[i])) {
						triggerEvent(document.querySelector(websiteDataValues.claimButtonSelectors[i]), 'mousedown');
						triggerEvent(document.querySelector(websiteDataValues.claimButtonSelectors[i]), 'mouseup');
						document.querySelector(websiteDataValues.claimButtonSelectors[i]).click();
						break;
					}
				}
			}
		}, 2000);




		var clicked = false;
		var captchaInterval = setInterval(function() {

			if (websiteDataValues.ablinks && !ablinksSolved) {
				return;
			}

			try {
				if (!clicked && unsafeWindow.grecaptcha && unsafeWindow.grecaptcha.getResponse().length > 0 &&
					websiteDataValues.captchaButtonSubmitSelector && document.querySelector(websiteDataValues.captchaButtonSubmitSelector) &&
					document.querySelector(websiteDataValues.captchaButtonSubmitSelector).style.display != 'none' &&
					!document.querySelector(websiteDataValues.captchaButtonSubmitSelector).disabled) {
					if (websiteDataValues.formSubmit) {
						document.querySelector(websiteDataValues.captchaButtonSubmitSelector).submit();
					} else {
						document.querySelector(websiteDataValues.captchaButtonSubmitSelector).click();
					}
					clicked = true;

					clearInterval(captchaInterval);
					setTimeout(function() {
						if (messageSelectorsPresent()) {
							goToNextUrl();
						}
					}, 20000);
				}
			} catch (e) {

			}

			for (var hc = 0; hc < document.querySelectorAll("iframe").length; hc++) {
				if (!clicked && document.querySelectorAll("iframe")[hc] &&
					document.querySelectorAll("iframe")[hc].hasAttribute("data-hcaptcha-response") &&
					document.querySelectorAll("iframe")[hc].getAttribute("data-hcaptcha-response").length > 0 &&
					websiteDataValues.captchaButtonSubmitSelector && document.querySelector(websiteDataValues.captchaButtonSubmitSelector) &&
					document.querySelector(websiteDataValues.captchaButtonSubmitSelector).style.display != 'none' &&
					!document.querySelector(websiteDataValues.captchaButtonSubmitSelector).disabled) {
					if (websiteDataValues.formSubmit) {
						document.querySelector(websiteDataValues.captchaButtonSubmitSelector).submit();
					} else {
						document.querySelector(websiteDataValues.captchaButtonSubmitSelector).click();
					}
					clicked = true;
					clearInterval(captchaInterval);
					setTimeout(function() {
						if (messageSelectorsPresent()) {
							goToNextUrl();
						}
					}, 2000);
				}
			}
		}, 2000);
	}, 2000);

})();