# -*- coding: utf-8 -*- import time import os import json import httpx class DuDog: def __init__(self, cookies_list): self.cookies_list = cookies_list def roll(self): url = "https://www.magicnewton.com/portal/api/userQuests" for cookies in self.cookies_list: headers = { "accept": "*/*", "accept-encoding": "gzip, deflate, br, zstd", "accept-language": "zh-CN,zh;q=0.9", "content-type": "application/json", "cookie": cookies, "origin": "https://www.magicnewton.com", "priority": "u=1, i", "referer": "https://www.magicnewton.com/portal/rewards", "sec-ch-ua": '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"', "sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": '"Windows"', "sec-fetch-dest": "empty", "sec-fetch-mode": "cors", "sec-fetch-site": "same-origin", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36" } payload = {"questId": "f56c760b-2186-40cb-9cbc-3af4a3dc20e2", "metadata": {"action": "ROLL"}} for times in range(6): try: response = httpx.post(url, headers=headers, json=payload) print(response.json()) if response.json().get('message') == 'Quest already completed': print('Is Done!') break except Exception as e: print(str(e)) time.sleep(3) if __name__ == '__main__': config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.txt") try: with open(config_path, "r", encoding="utf-8") as file: cookies_list = file.readlines() except Exception as e: print(f"读取配置失败:{e}") exit(1) D = DuDog(cookies_list) D.roll()