كي تقوم بتكرار العملية باستخدام نفس البريد الإلكتروني وكلمة المرور بعد إدخالها مرة واحدة، يمكنك استخدام حلقة while. هذا سيتيح لك تشغيل العملية عدد مرات تحدده أو إلى أن توقف العملية يدويًا. في المثال التالي، سأقوم بإنشاء حلقة تكرارية تتوقف بعد عدد معين من المحاولات. يمكنك تعديل العدد حسب رغبتك أو يمكنك جعله غير محدود:
import requests
import json
import time
# Define the messages
message1 = 'Congratulations on receiving'
message2 = 'It has been deposited into your account balance and can be viewed on the dashboard!'
# Request email and password from the user once
email = input('Enter Email: \n==>')
password = input('Enter Pass: \n==>')
# Define the number of attempts
number_of_attempts = 5 # You can change this value or make it loop indefinitely using "while True:"
for attempt in range(number_of_attempts):
# First Request
cookies = {
'googtrans': '/en/en',
'show_nt1': '1',
'login': '1',
'user': '957267646767-197.48.12.95',
}
headers = {
'accept': 'application/json, text/javascript, */*; q=0.01',
'accept-language': 'en-GB,en;q=0.6',
'content-type': 'application/json',
'dnt': '1',
'origin': 'https://faucetearner.org',
'priority': 'u=1, i',
'referer': 'https://faucetearner.org/login.php',
'sec-ch-ua': '"Not/A)Brand";v="8", "Chromium";v="126", "Brave";v="126"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'sec-gpc': '1',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
'x-requested-with': 'XMLHttpRequest',
}
params = {
'act': 'login',
}
json_data = {
'email': email,
'password': password,
}
response = requests.post('https://faucetearner.org/api.php', params=params, cookies=cookies, headers=headers, json=json_data)
json_data = response.cookies
json_data = str(json_data)
start_index = json_data.find("user=") + 5
end_index = json_data.find(" for", start_index)
line3 = json_data[start_index:end_index]
# Second Request
cookies = {
'googtrans': '/en/en',
'show_nt1': '1',
'login': '1',
'user': line3,
}
headers = {
'accept': 'application/json, text/javascript, */*; q=0.01',
'accept-language': 'en-GB,en;q=0.6',
'dnt': '1',
'origin': 'https://faucetearner.org',
'priority': 'u=1, i',
'referer': 'https://faucetearner.org/faucet.php',
'sec-ch-ua': '"Not/A)Brand";v="8", "Chromium";v="126", "Brave";v="126"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'sec-gpc': '1',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
'x-requested-with': 'XMLHttpRequest',
}
params = {
'act': 'faucet',
}
json_data = {}
response = requests.post('https://faucetearner.org/api.php', params=params, cookies=cookies, headers=headers, json=json_data)
json_data2 = response.text
json_data2 = str(json_data2)
start_index = json_data2.find(">") + 1
end_index = json_data2.find(" XRP", start_index)
line1 = json_data2[start_index:end_index]
if 'Congratulations on receiving' in response.text:
print(f'{message1} {line1} {message2}')
else:
print('You have already claimed, please wait for the next wave!')
# Wait before the next attempt (e.g. 60 seconds)
time.sleep(60)
في هذا المثال، سيتم تكرار العملية خمس مرات مع الانتظار لمدة 60 ثانية بين كل محاولة. يمكنك ضبط قيمة number_of_attempts أو تحويلها إلى حلقة غير محددة باستخدام while True:، كما يمكن تعديل زمن الانتظار حسب الحاجة باستخدام time.sleep().