├── requirements.txt ├── start.bat ├── .env.example ├── README.md └── auto_claim.py /requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.31.0 2 | schedule==1.2.0 3 | python-dotenv==1.0.0 4 | tqdm==4.66.1 -------------------------------------------------------------------------------- /start.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Starting Beamable Auto Claim program... 3 | python auto_claim.py 4 | pause -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | # Beamable Network Cookie 2 | # Login to https://hub.beamable.network, open developer tools (F12), 3 | # go to Network tab, refresh the page, find any request, 4 | # look at Request Headers, copy the Cookie value and paste it below 5 | BEAMABLE_COOKIE=your_cookie_here -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Beamable Auto Claim 2 | 3 | [Click to Register](https://hub.beamable.network/ref/C5SXY97H) Beamable Network 4 | 5 | This is an automated script that performs claim operations based on the countdown displayed on the Beamable Network website. 6 | 7 | ## Features 8 | 9 | - Automatically performs claim operations based on the countdown displayed on the website 10 | - Uses HTTP requests to get countdown information, no browser needed 11 | - Uses UTC time for all time calculations, consistent with Beamable Network 12 | - Defaults to a 12-hour interval if countdown cannot be parsed 13 | - Supports custom Cookie configuration 14 | - Detailed logging 15 | - Performs a claim operation immediately upon startup 16 | - Intelligently adjusts the next claim time 17 | - Ensures claims are performed before UTC 00:00 each day 18 | 19 | ## Installation 20 | 21 | 1. Ensure Python 3.7 or higher is installed 22 | 2. Clone or download this repository 23 | 3. Install dependencies: 24 | 25 | ```bash 26 | pip install -r requirements.txt 27 | ``` 28 | 29 | 4. Copy the environment variables example file and configure it: 30 | 31 | ```bash 32 | cp .env.example .env 33 | ``` 34 | 35 | 5. Edit the `.env` file, replacing `BEAMABLE_COOKIE` with your actual Cookie value 36 | 37 | ## Usage 38 | 39 | Run the following command to start the Auto Claim program: 40 | 41 | ```bash 42 | python auto_claim.py 43 | ``` 44 | 45 | Alternatively, on Windows, you can simply double-click the `start.bat` file. 46 | 47 | The program will immediately perform a claim operation and automatically schedule the next claim based on the countdown displayed on the website. 48 | 49 | ## How to Get Your Cookie 50 | 51 | 1. Log in to the Beamable Network website (https://hub.beamable.network) 52 | 2. Open browser developer tools (F12 or right-click -> Inspect) 53 | 3. Switch to the "Network" tab 54 | 4. Refresh the page 55 | 5. Find any request and look at its "Request Headers" 56 | 6. Find the "Cookie" field and copy its value 57 | 7. Paste the copied value into the `.env` file for the `BEAMABLE_COOKIE` variable 58 | 59 | ## Logging 60 | 61 | Program logs are saved in the `auto_claim.log` file and also displayed in the console. All log timestamps are shown in UTC time, formatted as `YYYY-MM-DD HH:MM:SS UTC`. 62 | 63 | ## How It Works 64 | 65 | 1. The program performs a claim operation immediately upon startup 66 | 2. The program uses HTTP requests to get the webpage content and parse the countdown information 67 | 3. The program schedules the next claim based on the parsed countdown 68 | 4. If the countdown cannot be parsed, it uses the default 12-hour interval 69 | 5. After each successful claim, it gets and sets the time for the next claim 70 | 6. All time calculations use UTC time, consistent with the Beamable Network website 71 | 7. The program ensures claims are performed before UTC 00:00 each day (actually at 23:30 UTC to provide a 30-minute buffer) 72 | 73 | ## About Timezones 74 | 75 | The Beamable Network website displays countdowns in UTC time. This script also uses UTC time for all time calculations to ensure synchronization with the website. This means: 76 | 77 | - Times displayed in logs are in UTC time, which may differ from your local time 78 | - The script gets the actual countdown directly from the webpage, ensuring accuracy 79 | - The script automatically handles timezone differences, ensuring claim operations are performed at the correct time 80 | 81 | ## Notes 82 | 83 | - Cookies may expire; if claim operations fail, update the Cookie value 84 | - It is recommended to deploy this program on a server that runs 24/7 85 | - The default claim interval is 12 hours; to change this, modify the `schedule_default_claim` function in the `auto_claim.py` file -------------------------------------------------------------------------------- /auto_claim.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import os 5 | import time 6 | import logging 7 | import requests 8 | import schedule 9 | import re 10 | from datetime import datetime, timedelta, timezone 11 | from dotenv import load_dotenv 12 | 13 | # Create custom log formatter to display UTC time 14 | class UTCFormatter(logging.Formatter): 15 | def formatTime(self, record, datefmt=None): 16 | dt = datetime.fromtimestamp(record.created, timezone.utc) 17 | if datefmt: 18 | return dt.strftime(datefmt) 19 | else: 20 | return dt.strftime('%Y-%m-%d %H:%M:%S UTC') 21 | 22 | # Configure logging 23 | logging.basicConfig( 24 | level=logging.INFO, 25 | handlers=[ 26 | logging.FileHandler("auto_claim.log"), 27 | logging.StreamHandler() 28 | ] 29 | ) 30 | # Set custom formatter 31 | formatter = UTCFormatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') 32 | for handler in logging.root.handlers: 33 | handler.setFormatter(formatter) 34 | 35 | logger = logging.getLogger("AutoClaim") 36 | 37 | # Load environment variables 38 | load_dotenv() 39 | 40 | # Get Cookie from environment variables, no default value for security 41 | COOKIE = os.getenv('BEAMABLE_COOKIE', '') 42 | if not COOKIE: 43 | logger.error("BEAMABLE_COOKIE not found in environment variables. Please set it in the .env file.") 44 | logger.error("Exiting program due to missing cookie.") 45 | exit(1) 46 | 47 | # Website URLs 48 | BEAMABLE_URL = "https://hub.beamable.network/modules/preregclaim" 49 | BEAMABLE_API_URL = "https://hub.beamable.network/api/claim" 50 | 51 | def get_cookies_dict(): 52 | """Convert cookie string to dictionary""" 53 | cookies = {} 54 | for item in COOKIE.split(';'): 55 | if '=' in item: 56 | key, value = item.strip().split('=', 1) 57 | cookies[key] = value 58 | return cookies 59 | 60 | def get_headers(): 61 | """Get request headers""" 62 | return { 63 | "accept": "*/*", 64 | "accept-language": "zh-CN,zh;q=0.9,en;q=0.8", 65 | "content-type": "application/json", 66 | "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36", 67 | "referer": BEAMABLE_URL 68 | } 69 | 70 | def perform_claim(): 71 | """Perform claim operation""" 72 | try: 73 | logger.info("Starting claim operation...") 74 | 75 | # Get page content 76 | logger.info("Getting page content...") 77 | cookies = get_cookies_dict() 78 | headers = get_headers() 79 | 80 | try: 81 | # First get page content to check if already claimed and countdown info 82 | response = requests.get( 83 | BEAMABLE_URL, 84 | headers=headers, 85 | cookies=cookies, 86 | timeout=10 87 | ) 88 | 89 | if response.status_code != 200: 90 | logger.error(f"Failed to get page! Status code: {response.status_code}") 91 | return False 92 | 93 | page_content = response.text 94 | 95 | # Check if already claimed 96 | if "ITEM CLAIMED" in page_content: 97 | logger.info("Item has already been claimed") 98 | 99 | # Try to parse countdown 100 | next_claim_time = parse_countdown(page_content) 101 | if next_claim_time: 102 | # Cancel all previous scheduled tasks 103 | schedule.clear() 104 | # Set new scheduled task 105 | schedule_next_claim(next_claim_time) 106 | return True 107 | else: 108 | # If not claimed, try to perform claim operation 109 | logger.info("Attempting to perform claim operation...") 110 | 111 | # Send claim request 112 | claim_response = requests.post( 113 | BEAMABLE_API_URL, 114 | headers=headers, 115 | cookies=cookies, 116 | json={"type": "daily"}, 117 | timeout=10 118 | ) 119 | 120 | if claim_response.status_code == 200: 121 | logger.info("Claim successful!") 122 | 123 | # Get page again to parse next claim time 124 | response = requests.get( 125 | BEAMABLE_URL, 126 | headers=headers, 127 | cookies=cookies, 128 | timeout=10 129 | ) 130 | 131 | if response.status_code == 200: 132 | next_claim_time = parse_countdown(response.text) 133 | if next_claim_time: 134 | # Cancel all previous scheduled tasks 135 | schedule.clear() 136 | # Set new scheduled task 137 | schedule_next_claim(next_claim_time) 138 | return True 139 | else: 140 | logger.error(f"Claim request failed! Status code: {claim_response.status_code}") 141 | logger.error(f"Response content: {claim_response.text}") 142 | 143 | except requests.exceptions.RequestException as e: 144 | logger.error(f"Request exception: {str(e)}") 145 | 146 | # If all above steps failed, use default scheduling strategy 147 | logger.info("Unable to get accurate next claim time, using default time") 148 | schedule_default_claim() 149 | return False 150 | 151 | except Exception as e: 152 | logger.error(f"Error during claim operation: {str(e)}") 153 | return False 154 | 155 | def parse_countdown(html_content): 156 | """Parse countdown from HTML content""" 157 | try: 158 | # Try to find time after "Time to Claim:" 159 | # Format 1: Numbers displayed in hours and minutes divs 160 | hours_pattern = re.search(r'