├── requirements.txt ├── .env ├── README.md └── main.py /requirements.txt: -------------------------------------------------------------------------------- 1 | colorama==0.4.6 2 | httpx==0.27.0 3 | python-dotenv==1.0.1 4 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | REFRESH_CLAIM = 60 2 | REFRESH_TOKEN = 3600 # in second 3 | AUTO_TASKS = true 4 | AUTO_CLAIM_REFF = true 5 | AUTO_UPGRADE = true -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # timefarm-bot 2 | timefarm bot auto claim/farming multiple account https://t.me/TimeFarmCryptoBot 3 | 4 | 2024-06-21 00_17_28-main py - tapbot - Visual Studio Code 5 | 6 | ## Features 7 | - Auto create token (login by query_id) 8 | - Auto start/claim farming 9 | - Auto upgrade 10 | - Auto complete tasks 11 | - Auto claim refferal balance 12 | - Auto refresh token 13 | 14 | ## Requirement 15 | - Python 3.8+ 16 | 17 | ## How to run 18 | 1. Clone/download this repository 19 | 2. > pip install -r requirements.txt 20 | 3. > python main.py 21 | 22 | ## How to get query_id? 23 | 1. Open telegram web/desktop 24 | 2. Go to Settings - Advanced - Experimental settings - Enable webview inspecting 25 | 3. Open bot https://t.me/TimeFarmCryptoBot 26 | 4. Press F12 or right click then select inspect element 27 | 5. Go to Application tab - Session storage - Select tg-tap-miniapp/timefarm - Select '__telegram__initParams' (copy value start with ```query_id=```) 28 | 6. Separate query_id with the newline (for multiple account) 29 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import httpx 2 | import asyncio 3 | import json 4 | import time 5 | import os 6 | import datetime 7 | from colorama import Fore, Style, init 8 | from dotenv import load_dotenv 9 | import ast 10 | 11 | init() 12 | load_dotenv() 13 | 14 | async def getToken(session, query): 15 | url = "https://tg-bot-tap.laborx.io/api/v1/auth/validate-init/v2" 16 | 17 | payload = json.dumps({ 18 | "initData": f"{query}", 19 | "platform": "tdesktop" 20 | }) 21 | 22 | headers = { 23 | 'accept': '*/*', 24 | 'accept-language': 'en-US,en;q=0.9', 25 | 'content-type': 'application/json', 26 | 'origin': 'https://timefarm.app', 27 | 'priority': 'u=1, i', 28 | 'referer': 'https://timefarm.app/', 29 | 'sec-ch-ua': '"Chromium";v="128", "Not;A=Brand";v="24", "Microsoft Edge";v="128", "Microsoft Edge WebView2";v="128"', 30 | 'sec-ch-ua-mobile': '?0', 31 | 'sec-ch-ua-platform': '"Windows"', 32 | 'sec-fetch-dest': 'empty', 33 | 'sec-fetch-mode': 'cors', 34 | 'sec-fetch-site': 'cross-site', 35 | 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Edg/128.0.0.0' 36 | } 37 | 38 | while True: 39 | try: 40 | resp = await session.post(url, headers=headers, data=payload) 41 | 42 | if resp.status_code == 200: 43 | # print(resp.json()) 44 | return resp.json() 45 | else: 46 | continue 47 | except httpx.HTTPError as e: 48 | print(f"Error to getToken, try again ... {e}") 49 | 50 | async def getInfoUser(session, token): 51 | url = "https://tg-bot-tap.laborx.io/api/v1/farming/info" 52 | 53 | headers = { 54 | 'accept': '*/*', 55 | 'accept-language': 'en-US,en;q=0.9', 56 | 'authorization': f'Bearer {token}', 57 | 'origin': 'https://tg-tap-miniapp.laborx.io', 58 | 'priority': 'u=1, i', 59 | 'referer': 'https://tg-tap-miniapp.laborx.io/', 60 | 'sec-ch-ua': '"Microsoft Edge";v="125", "Chromium";v="125", "Not.A/Brand";v="24", "Microsoft Edge WebView2";v="125"', 61 | 'sec-ch-ua-mobile': '?0', 62 | 'sec-ch-ua-platform': '"Windows"', 63 | 'sec-fetch-dest': 'empty', 64 | 'sec-fetch-mode': 'cors', 65 | 'sec-fetch-site': 'same-site', 66 | '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' 67 | } 68 | 69 | while True: 70 | try: 71 | resp = await session.get(url, headers=headers) 72 | 73 | if resp.status_code == 200: 74 | # print(resp.json()) 75 | return resp.json() 76 | else: 77 | continue 78 | except httpx.HTTPError as e: 79 | print(f"Error to getInfoUser, try again ... {e}") 80 | 81 | async def getListTask(session, token): 82 | url = "https://tg-bot-tap.laborx.io/api/v1/tasks" 83 | 84 | headers = { 85 | 'accept': '*/*', 86 | 'accept-language': 'en-US,en;q=0.9', 87 | 'authorization': f'Bearer {token}', 88 | 'origin': 'https://tg-tap-miniapp.laborx.io', 89 | 'priority': 'u=1, i', 90 | 'referer': 'https://tg-tap-miniapp.laborx.io/', 91 | 'sec-ch-ua': '"Microsoft Edge";v="125", "Chromium";v="125", "Not.A/Brand";v="24", "Microsoft Edge WebView2";v="125"', 92 | 'sec-ch-ua-mobile': '?0', 93 | 'sec-ch-ua-platform': '"Windows"', 94 | 'sec-fetch-dest': 'empty', 95 | 'sec-fetch-mode': 'cors', 96 | 'sec-fetch-site': 'same-site', 97 | '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' 98 | } 99 | 100 | while True: 101 | try: 102 | resp = await session.get(url, headers=headers) 103 | 104 | if resp.status_code == 200: 105 | # print(resp.json()) 106 | return resp.json() 107 | else: 108 | continue 109 | except httpx.HTTPError as e: 110 | print(f"Error to getListTask, try again ... {e}") 111 | 112 | async def getReffInfo(session, token): 113 | url = "https://tg-bot-tap.laborx.io/api/v1/referral/link" 114 | 115 | headers = { 116 | 'accept': '*/*', 117 | 'accept-language': 'en-US,en;q=0.9', 118 | 'authorization': f'Bearer {token}', 119 | 'origin': 'https://tg-tap-miniapp.laborx.io', 120 | 'priority': 'u=1, i', 121 | 'referer': 'https://tg-tap-miniapp.laborx.io/', 122 | 'sec-ch-ua': '"Microsoft Edge";v="125", "Chromium";v="125", "Not.A/Brand";v="24", "Microsoft Edge WebView2";v="125"', 123 | 'sec-ch-ua-mobile': '?0', 124 | 'sec-ch-ua-platform': '"Windows"', 125 | 'sec-fetch-dest': 'empty', 126 | 'sec-fetch-mode': 'cors', 127 | 'sec-fetch-site': 'same-site', 128 | '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' 129 | } 130 | 131 | while True: 132 | try: 133 | resp = await session.get(url, headers=headers) 134 | 135 | if resp.status_code == 200: 136 | # print(resp.json()) 137 | return resp.json() 138 | else: 139 | continue 140 | except httpx.HTTPError as e: 141 | print(f"Error to getReffInfo, try again ... {e}") 142 | 143 | async def startFarming(session, token): 144 | url = "https://tg-bot-tap.laborx.io/api/v1/farming/start" 145 | 146 | payload = json.dumps({}) 147 | 148 | headers = { 149 | 'accept': '*/*', 150 | 'accept-language': 'en-US,en;q=0.9', 151 | 'authorization': f'Bearer {token}', 152 | 'content-type': 'application/json', 153 | 'origin': 'https://tg-tap-miniapp.laborx.io', 154 | 'priority': 'u=1, i', 155 | 'referer': 'https://tg-tap-miniapp.laborx.io/', 156 | 'sec-ch-ua': '"Microsoft Edge";v="125", "Chromium";v="125", "Not.A/Brand";v="24", "Microsoft Edge WebView2";v="125"', 157 | 'sec-ch-ua-mobile': '?0', 158 | 'sec-ch-ua-platform': '"Windows"', 159 | 'sec-fetch-dest': 'empty', 160 | 'sec-fetch-mode': 'cors', 161 | 'sec-fetch-site': 'same-site', 162 | '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' 163 | } 164 | 165 | while True: 166 | try: 167 | resp = await session.post(url, headers=headers, data=payload) 168 | 169 | if resp.status_code == 200: 170 | # print(resp.json()) 171 | return resp.json() 172 | elif resp.status_code == 403: # farming already start 173 | # print(resp.json()) 174 | return resp.json() 175 | else: 176 | continue 177 | except httpx.HTTPError as e: 178 | print(f"Error to startFarming, try again ... {e}") 179 | 180 | async def finishFarming(session, token): 181 | url = "https://tg-bot-tap.laborx.io/api/v1/farming/finish" 182 | 183 | payload = json.dumps({}) 184 | 185 | headers = { 186 | 'accept': '*/*', 187 | 'accept-language': 'en-US,en;q=0.9', 188 | 'authorization': f'Bearer {token}', 189 | 'content-type': 'application/json', 190 | 'origin': 'https://tg-tap-miniapp.laborx.io', 191 | 'priority': 'u=1, i', 192 | 'referer': 'https://tg-tap-miniapp.laborx.io/', 193 | 'sec-ch-ua': '"Microsoft Edge";v="125", "Chromium";v="125", "Not.A/Brand";v="24", "Microsoft Edge WebView2";v="125"', 194 | 'sec-ch-ua-mobile': '?0', 195 | 'sec-ch-ua-platform': '"Windows"', 196 | 'sec-fetch-dest': 'empty', 197 | 'sec-fetch-mode': 'cors', 198 | 'sec-fetch-site': 'same-site', 199 | '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' 200 | } 201 | 202 | while True: 203 | try: 204 | resp = await session.post(url, headers=headers, data=payload) 205 | 206 | if resp.status_code == 200: 207 | # print(resp.json()) 208 | return resp.json() 209 | elif resp.status_code == 403: # farming already start 210 | # print(resp.json()) 211 | return resp.json() 212 | else: 213 | continue 214 | except httpx.HTTPError as e: 215 | print(f"Error to finishFarming, try again ... {e}") 216 | 217 | async def startTask(session, token, idtask): 218 | url = f"https://tg-bot-tap.laborx.io/api/v1/tasks/{idtask}/submissions" 219 | 220 | headers = { 221 | 'accept': '*/*', 222 | 'accept-language': 'en-US,en;q=0.9', 223 | 'authorization': f'Bearer {token}', 224 | 'origin': 'https://tg-tap-miniapp.laborx.io', 225 | 'priority': 'u=1, i', 226 | 'referer': 'https://tg-tap-miniapp.laborx.io/', 227 | 'sec-ch-ua': '"Microsoft Edge";v="125", "Chromium";v="125", "Not.A/Brand";v="24", "Microsoft Edge WebView2";v="125"', 228 | 'sec-ch-ua-mobile': '?0', 229 | 'sec-ch-ua-platform': '"Windows"', 230 | 'sec-fetch-dest': 'empty', 231 | 'sec-fetch-mode': 'cors', 232 | 'sec-fetch-site': 'same-site', 233 | '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' 234 | } 235 | 236 | while True: 237 | try: 238 | resp = await session.post(url, headers=headers) 239 | 240 | if resp.status_code == 200: 241 | # print(resp.status_code) 242 | # print(resp.json()) 243 | return resp.json() 244 | elif resp.status_code == 400: 245 | # print(resp.json()) 246 | return resp.json() # already submitted 247 | else: 248 | continue 249 | except httpx.HTTPError as e: 250 | print(f"Error to startTask, try again ... {e}") 251 | except json.decoder.JSONDecodeError as e: 252 | # print(f"{e}") 253 | continue 254 | 255 | async def claimTask(session, token, idtask): 256 | url = f"https://tg-bot-tap.laborx.io/api/v1/tasks/{idtask}/claims" 257 | 258 | payload = json.dumps({}) 259 | 260 | headers = { 261 | 'accept': '*/*', 262 | 'accept-language': 'en-US,en;q=0.9', 263 | 'authorization': f'Bearer {token}', 264 | 'origin': 'https://tg-tap-miniapp.laborx.io', 265 | 'priority': 'u=1, i', 266 | 'referer': 'https://tg-tap-miniapp.laborx.io/', 267 | 'sec-ch-ua': '"Microsoft Edge";v="125", "Chromium";v="125", "Not.A/Brand";v="24", "Microsoft Edge WebView2";v="125"', 268 | 'sec-ch-ua-mobile': '?0', 269 | 'sec-ch-ua-platform': '"Windows"', 270 | 'sec-fetch-dest': 'empty', 271 | 'sec-fetch-mode': 'cors', 272 | 'sec-fetch-site': 'same-site', 273 | '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' 274 | } 275 | 276 | while True: 277 | try: 278 | resp = await session.post(url, headers=headers, data=payload) 279 | 280 | if resp.status_code == 200: 281 | # print(resp.json()) 282 | return resp.json() 283 | elif resp.status_code == 400: 284 | # print(resp.json()) 285 | return resp.json() # already submitted 286 | else: 287 | continue 288 | except httpx.HTTPError as e: 289 | print(f"Error to claimTask, try again ... {e}") 290 | except json.decoder.JSONDecodeError as e: 291 | # print(f"{e}") 292 | continue 293 | 294 | async def claimReff(session, token): 295 | url = "https://tg-bot-tap.laborx.io/api/v1/balance/referral/claim" 296 | 297 | payload = json.dumps({}) 298 | 299 | headers = { 300 | 'accept': '*/*', 301 | 'accept-language': 'en-US,en;q=0.9', 302 | 'authorization': f'Bearer {token}', 303 | 'content-type': 'application/json', 304 | 'origin': 'https://tg-tap-miniapp.laborx.io', 305 | 'priority': 'u=1, i', 306 | 'referer': 'https://tg-tap-miniapp.laborx.io/', 307 | 'sec-ch-ua': '"Microsoft Edge";v="125", "Chromium";v="125", "Not.A/Brand";v="24", "Microsoft Edge WebView2";v="125"', 308 | 'sec-ch-ua-mobile': '?0', 309 | 'sec-ch-ua-platform': '"Windows"', 310 | 'sec-fetch-dest': 'empty', 311 | 'sec-fetch-mode': 'cors', 312 | 'sec-fetch-site': 'same-site', 313 | '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' 314 | } 315 | 316 | while True: 317 | try: 318 | resp = await session.post(url, headers=headers, data=payload) 319 | 320 | if resp.status_code == 200: 321 | # print(resp.json()) 322 | return resp.json() 323 | elif resp.status_code == 403: 324 | # print(resp.json()) 325 | return resp.json() # nothing to claim 326 | else: 327 | continue 328 | except httpx.HTTPError as e: 329 | print(f"Error to claimReff, try again ... {e}") 330 | except json.decoder.JSONDecodeError as e: 331 | # print(f"{e}") 332 | continue 333 | 334 | async def upgradeLevel(session, token): 335 | url = "https://tg-bot-tap.laborx.io/api/v1/me/level/upgrade" 336 | 337 | payload = json.dumps({}) 338 | 339 | headers = { 340 | 'accept': '*/*', 341 | 'accept-language': 'en-US,en;q=0.9', 342 | 'authorization': f'Bearer {token}', 343 | 'content-type': 'application/json', 344 | 'origin': 'https://tg-tap-miniapp.laborx.io', 345 | 'priority': 'u=1, i', 346 | 'referer': 'https://tg-tap-miniapp.laborx.io/', 347 | 'sec-ch-ua': '"Microsoft Edge";v="125", "Chromium";v="125", "Not.A/Brand";v="24", "Microsoft Edge WebView2";v="125"', 348 | 'sec-ch-ua-mobile': '?0', 349 | 'sec-ch-ua-platform': '"Windows"', 350 | 'sec-fetch-dest': 'empty', 351 | 'sec-fetch-mode': 'cors', 352 | 'sec-fetch-site': 'same-site', 353 | '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' 354 | } 355 | 356 | while True: 357 | try: 358 | resp = await session.post(url, headers=headers, data=payload) 359 | 360 | if resp.status_code == 200: 361 | # print(resp.json()) 362 | return resp.json() 363 | elif resp.status_code == 403: 364 | # print(resp.json()) 365 | return resp.json() # "message": "Max level reached", message': 'Not enough balance', 366 | else: 367 | continue 368 | except httpx.HTTPError as e: 369 | print(f"Error to upgradeLevel, try again ... {e}") 370 | except json.decoder.JSONDecodeError as e: 371 | # print(f"{e}") 372 | continue 373 | 374 | async def runGetToken(): 375 | try: 376 | with open('query.txt', 'r') as qf: 377 | querys = qf.readlines() 378 | async with httpx.AsyncClient() as session: 379 | for i in range(len(querys)): 380 | # print(querys[i].strip()) 381 | query = querys[i].strip() 382 | 383 | get_token = await getToken(session, query) 384 | levelnow = get_token['info']['level'] 385 | token = get_token['token'] 386 | level = get_token['levelDescriptions'] 387 | 388 | querys[i] = f"{levelnow}|{token}|{level}\n" 389 | 390 | with open('tokens.txt', 'w+') as tf: 391 | tf.writelines(querys) 392 | print("Create token success!") 393 | except FileNotFoundError: 394 | qf = open('query.txt', 'w') 395 | print("Fill the query.txt first!") 396 | qf.write("query1\nquery2\ndst...") 397 | qf.close() 398 | exit() 399 | 400 | def countLength(n): 401 | num = str(n) 402 | return len(num) 403 | 404 | async def runAll(levelnow, token, index, upgradelist): 405 | async with httpx.AsyncClient() as session: 406 | info = await getInfoUser(session, token) 407 | list_task = await getListTask(session, token) 408 | reff_info = await getReffInfo(session, token) 409 | 410 | balance = float(info['balance']) 411 | farming_duration = int(info['farmingDurationInSec']/60/60) 412 | farming_reward = info['farmingReward'] 413 | total_reff = reff_info['userCount'] 414 | 415 | if total_reff > 0: 416 | status_reff = f"{Fore.GREEN}{total_reff}{Style.RESET_ALL}" 417 | else: 418 | status_reff = total_reff 419 | 420 | start_farm = await startFarming(session, token) #if message/error in startFarming: farming started 421 | claim_farm = await finishFarming(session, token) 422 | 423 | status_farm = "-" 424 | if 'error' in start_farm: 425 | status_farm = f"{Fore.YELLOW}Farming{Style.RESET_ALL}" 426 | else: 427 | status_farm = f"{Fore.GREEN}Farming started{Style.RESET_ALL}" 428 | 429 | if os.getenv("AUTO_TASKS") == "true" or os.getenv("AUTO_TASKS") == "yes" or os.getenv("AUTO_TASKS") == "y": 430 | status_task = f"{Fore.GREEN}On{Style.RESET_ALL}" 431 | for i in list_task: 432 | idtask = i['id'] 433 | await startTask(session, token, idtask) 434 | 435 | for i in list_task: 436 | idtask = i['id'] 437 | await claimTask(session, token, idtask) 438 | 439 | status_task = f"{Fore.GREEN}All task completed{Style.RESET_ALL}" 440 | else: 441 | status_task = "Off" 442 | 443 | if os.getenv("AUTO_CLAIM_REFF") == "true" or os.getenv("AUTO_CLAIM_REFF") == "yes" or os.getenv("AUTO_CLAIM_REFF") == "y": 444 | status_autoclaimreff = f"{Fore.GREEN}On{Style.RESET_ALL}" 445 | claimreff_res = await claimReff(session, token) 446 | if 'error' in claimreff_res: 447 | status_autoclaimreff = f"{Fore.YELLOW}{claimreff_res['error']['message']}{Style.RESET_ALL}" 448 | else: 449 | status_autoclaimreff = f"{Fore.GREEN}Success{Style.RESET_ALL}" 450 | else: 451 | status_autoclaimreff = "Off" 452 | 453 | if os.getenv("AUTO_UPGRADE") == "true": 454 | status_upgrade = f"{Fore.GREEN}On{Style.RESET_ALL}" 455 | for i in upgradelist: 456 | if 'price' in i: 457 | if i['price'] != -1 and i['level'] > levelnow and balance > i['price']: 458 | await upgradeLevel(session, token) 459 | else: 460 | pass 461 | else: 462 | status_upgrade = "Off" 463 | 464 | lengcount = countLength(index) 465 | 466 | if lengcount == 1: 467 | print(f"[Account 0{index}] | Level : {levelnow} | Balance : {Fore.GREEN}{int(balance)}{Style.RESET_ALL} | Reward : {farming_reward}/{farming_duration} hours | Status : {status_farm} | Tasks : {status_task} | Auto upgrade : {status_upgrade} | Referral : {status_reff} ") 468 | else: 469 | print(f"[Account {index}] | Level : {levelnow} | Balance : {Fore.GREEN}{int(balance)}{Style.RESET_ALL} | Reward : {farming_reward}/{farming_duration} hours | Status : {status_farm} | Tasks : {status_task} | Auto upgrade : {status_upgrade} | Referral : {status_reff} ") 470 | 471 | async def main(): 472 | # query = "" 473 | 474 | os.system("cls" if os.name == "nt" else "clear") # remove the printed 475 | 476 | print("Create token started") 477 | await runGetToken() 478 | 479 | sekarang = time.time() 480 | nanti = time.time() + int(os.getenv("REFRESH_TOKEN")) 481 | 482 | while sekarang < nanti: 483 | print(""" 484 | _ _ __ _ _ 485 | | |_(_)_ __ ___ ___ / _| __ _ _ __ _ __ ___ | |__ ___ | |_ 486 | | __| | '_ ` _ \ / _ \ | |_ / _` | '__| '_ ` _ \ | '_ \ / _ \| __| 487 | | |_| | | | | | | __/ | _| (_| | | | | | | | | | |_) | (_) | |_ 488 | \__|_|_| |_| |_|\___| |_| \__,_|_| |_| |_| |_| |_.__/ \___/ \__| 489 | """) 490 | start = time.time() 491 | schedules = [] 492 | with open('tokens.txt', 'r') as tf: 493 | tokens = tf.readlines() 494 | for i in range(len(tokens)): 495 | # print(tokens[i].strip()) 496 | token_auth = tokens[i].strip().split("|") 497 | # print(token_auth[0]) 498 | upgradelist = ast.literal_eval(token_auth[2]) 499 | schedules.append(asyncio.create_task(runAll(token_auth[0], token_auth[1], i+1, upgradelist))) 500 | 501 | # gather to run concurently 502 | await asyncio.gather(*schedules) # BOOOMMMM TO RUN 503 | 504 | print("") 505 | finish = time.time()-start 506 | #################### CHANGE THE REFRESH HERE #################### 507 | claim_remaining = int(os.getenv("REFRESH_CLAIM")) # set to 2 menit or 120 seconds 508 | refresh_token_at = datetime.datetime.fromtimestamp(nanti).strftime("%H:%M:%S") 509 | ############################################################### 510 | 511 | while claim_remaining: 512 | hour, secs = divmod(claim_remaining, 60) 513 | timer = '{:02d}'.format(secs) 514 | print(f"Execution time : {Fore.YELLOW}{round(finish, 2)}{Style.RESET_ALL} seconds | Refresh tokens after : {Fore.YELLOW}{refresh_token_at}{Style.RESET_ALL} | Refresh after : {Fore.YELLOW}{timer}{Style.RESET_ALL} seconds", end="\r") 515 | time.sleep(1) 516 | claim_remaining -= 1 517 | 518 | sekarang = time.time() + int(os.getenv("REFRESH_CLAIM")) 519 | if sekarang >= nanti: 520 | print("") 521 | print("Refresh tokens started!") 522 | await runGetToken() 523 | time.sleep(2) 524 | nanti = time.time() + int(os.getenv("REFRESH_TOKEN")) 525 | 526 | os.system("cls" if os.name == "nt" else "clear") # remove the printed 527 | 528 | if __name__ == "__main__": 529 | # Set the policy to prevent "Event loop is closed" error on Windows - https://github.com/encode/httpx/issues/914 530 | asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) 531 | asyncio.run(main()) 532 | --------------------------------------------------------------------------------