|
| 1 | +import sys |
| 2 | +import os |
| 3 | +from curl_cffi import requests |
| 4 | +import random |
| 5 | +import time |
| 6 | +from dotenv import load_dotenv |
| 7 | +from telegram.notify import send_tg_notification |
| 8 | + |
| 9 | +load_dotenv() |
| 10 | + |
| 11 | +# Get COOKIE from environment variable, multiple cookies separated by & |
| 12 | +cookies = os.environ.get('DEEPFLOOD_COOKIE', '').strip() |
| 13 | + |
| 14 | +if not cookies: |
| 15 | + raise ValueError("Environment variable DEEPFLOOD_COOKIE is not set") |
| 16 | + sys.exit(1) |
| 17 | + |
| 18 | +# Split multiple cookies by & to form a list |
| 19 | +cookie_list = cookies.split('&') |
| 20 | + |
| 21 | +# Request headers |
| 22 | +headers = { |
| 23 | + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0', |
| 24 | + 'Origin': 'https://www.deepflood.com', |
| 25 | + 'Referer': 'https://www.deepflood.com/board', |
| 26 | + 'Content-Type': 'application/json', |
| 27 | +} |
| 28 | + |
| 29 | +# Iterate over multiple account cookies for check-in |
| 30 | +for idx, cookie in enumerate(cookie_list): |
| 31 | + |
| 32 | + print(f"Using the {idx+1} account for check-in...", flush=True) |
| 33 | + # Generate a random delay |
| 34 | + random_delay = random.randint(1, 20) |
| 35 | + print(f"The {idx+1} account will wait for {random_delay} seconds...", flush=True) |
| 36 | + time.sleep(random_delay) |
| 37 | + |
| 38 | + # Add cookie to headers |
| 39 | + headers['Cookie'] = cookie.strip() |
| 40 | + |
| 41 | + try: |
| 42 | + # random=true means get a random bonus |
| 43 | + url = 'https://www.deepflood.com/api/attendance?random=true' |
| 44 | + response = requests.post(url, headers=headers, impersonate="chrome136") |
| 45 | + |
| 46 | + # Output the status code and response content |
| 47 | + print(f"The {idx+1} account's Status Code: {response.status_code}", flush=True) |
| 48 | + print(f"The {idx+1} account's Response Content: {response.text}", flush=True) |
| 49 | + |
| 50 | + # Check if the check-in is successful based on the response content |
| 51 | + if response.status_code == 200: |
| 52 | + success_message = f"DEEPFLOOD account {idx+1} check-in successful" |
| 53 | + print(success_message, flush=True) |
| 54 | + send_tg_notification(success_message) |
| 55 | + else: |
| 56 | + fail_message = f"DEEPFLOOD account {idx+1} check-in failed, response content: {response.text}" |
| 57 | + print(fail_message, flush=True) |
| 58 | + send_tg_notification(fail_message) |
| 59 | + sys.exit(1) |
| 60 | + |
| 61 | + except Exception as e: |
| 62 | + error_message = f"DEEPFLOOD account {idx+1} check-in process error: {e}" |
| 63 | + print(error_message, flush=True) |
| 64 | + send_tg_notification(error_message) |
| 65 | + sys.exit(1) |
0 commit comments