1225 条记录
52 私有链接
52 私有链接
Cursor注册脚本
import asyncio
import random
import string
from DrissionPage import Chromium
import requests
from mailtmapi import MailTM
import time
import re
import os
def generate_temp_password():
return "".join(random.choices(string.ascii_letters + string.digits, k=12))
async def main():
BASE_URL = "https://api.mail.tm"
mailtm = MailTM()
temp_mail = await mailtm.get_account()
password = generate_temp_password()
# 打开https://authenticator.cursor.sh/sign-up页面
tab = Chromium().latest_tab
tab.get("https://authenticator.cursor.sh/sign-up")
# 输入邮箱
print("input email")
email_input = tab.ele("@id=radix-:R2bapnltbnla:")
email_input.input(temp_mail.address)
time.sleep(1)
# 点击下一步
print("click continue")
tab.ele('@text()=Continue').click()
time.sleep(3)
password_input = tab.ele("@id=radix-:r1:")
print("input password")
password_input.input(password)
time.sleep(1)
# 点击下一步
print("click continue")
tab.ele('@text()=Continue').click()
print("waiting for email...")
time.sleep(10)
# 接收邮件
messages = await mailtm.get_messages(temp_mail.token.token, 1)
message = messages.hydra_member[0]
# print(message)
# 下载邮件
print("download email")
response = requests.get(BASE_URL + message.downloadUrl,
headers={'Authorization': f'Bearer {temp_mail.token.token}'})
# 解析邮件内容
message_text = response.text.strip().replace('\n', '').replace('\r', '').replace('=', '')
verify_code = re.search(r'Your verification code is (\d+)', message_text).group(1).strip()
print("verify_code: ", verify_code)
# 直接模拟键盘输入
for i in verify_code:
tab.actions.key_down(str(i))
time.sleep(0.1)
tab.actions.key_up(str(i))
time.sleep(5)
# 获取cookie 中的 WorkosCursorSessionToken
cookies = tab.cookies().as_dict()
print("Register Success!")
print("Account: ", temp_mail.address)
print("Password: ", password)
print("Cookies: ", cookies)
# 确保output文件夹存在
os.makedirs('output', exist_ok=True)
with open('output/cursor_accounts.txt', 'a', encoding='utf-8') as f:
f.write(f"Account: {temp_mail.address}\n")
f.write(f"Password: {password}\n")
f.write(f"Cookies: {cookies}\n")
f.write(f"\n")
if __name__ == "__main__":
repeat_times = 5 # 注册次数
for i in range(repeat_times):
try:
asyncio.run(main())
except Exception as e:
print(e)