93 lines
3.6 KiB
Python
Executable File
93 lines
3.6 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Firecrawl 100-Account Farmer
|
|
Run locally: python firecrawl_farmer.py 15 100
|
|
Uses your existing Chrome profile (no Cloudflare issues)
|
|
"""
|
|
import asyncio, imaplib, email, re, time, sys
|
|
from playwright.async_api import async_playwright
|
|
|
|
IMAP_EMAIL = "[REDACTED-NAME]@gmail.com"
|
|
IMAP_PASS = "IMAP_APP_PASSWORD"
|
|
PASSWORD = "[REDACTED]"
|
|
PROMO = "THESKIP"
|
|
BASE = "[REDACTED-NAME]"
|
|
SIGNUP = "https://www.firecrawl.dev/signin?view=signup"
|
|
|
|
def get_link(email_addr, timeout=15):
|
|
deadline = time.time() + timeout
|
|
while time.time() < deadline:
|
|
try:
|
|
mail = imaplib.IMAP4_SSL("imap.gmail.com")
|
|
mail.login(IMAP_EMAIL, IMAP_PASS)
|
|
mail.select("INBOX")
|
|
s, msgs = mail.search(None, f'TO "{email_addr}"')
|
|
if s == "OK" and msgs[0]:
|
|
mid = msgs[0].split()[-1]
|
|
_, d = mail.fetch(mid, "(RFC822)")
|
|
msg = email.message_from_bytes(d[0][1])
|
|
body = ""
|
|
if msg.is_multipart():
|
|
for p in msg.walk():
|
|
if p.get_content_type() == "text/html":
|
|
body = p.get_payload(decode=True).decode(errors='ignore')
|
|
break
|
|
for l in re.findall(r'https?://[^\s"<>]+', body):
|
|
if 'verify' in l or 'confirm' in l:
|
|
mail.logout(); return l.replace('&','&')
|
|
mail.logout()
|
|
except: pass
|
|
time.sleep(2)
|
|
return None
|
|
|
|
async def farm(page, n):
|
|
email = f"{BASE}+firecrawl{n}@gmail.com"
|
|
print(f"[{n}] {email}")
|
|
try:
|
|
await page.goto(SIGNUP, timeout=30000)
|
|
await page.wait_for_timeout(2000)
|
|
await page.fill('input[type="email"]', email)
|
|
await page.fill('input[type="password"]', PASSWORD)
|
|
await page.click('button[type="submit"]')
|
|
await page.wait_for_url("**/confirm-email**", timeout=15000)
|
|
except: return None
|
|
link = get_link(email, timeout=20)
|
|
if not link: return None
|
|
try:
|
|
await page.goto(link, timeout=15000)
|
|
await page.wait_for_timeout(2000)
|
|
await page.goto("https://www.firecrawl.dev/app", timeout=30000)
|
|
await page.wait_for_selector('text=Show key', timeout=10000)
|
|
await page.click('text=Show key')
|
|
await page.wait_for_timeout(500)
|
|
key = await page.evaluate("() => document.body.innerText.match(/fc-[a-zA-Z0-9]{30,50}/)?.[0]")
|
|
if not key: return None
|
|
team_url = page.url
|
|
await page.goto(team_url + "/settings?tab=billing", timeout=15000)
|
|
await page.wait_for_timeout(1000)
|
|
await page.fill('input', PROMO)
|
|
await page.wait_for_timeout(300)
|
|
await page.click('text=Apply')
|
|
await page.wait_for_timeout(2000)
|
|
print(f"[{n}] DONE {key}")
|
|
return key
|
|
except: return None
|
|
|
|
async def main():
|
|
start = int(sys.argv[1]) if len(sys.argv) > 1 else 15
|
|
count = int(sys.argv[2]) if len(sys.argv) > 2 else 100
|
|
results = {}
|
|
async with async_playwright() as p:
|
|
browser = await p.chromium.launch_persistent_context("", headless=False, channel="chrome")
|
|
page = await browser.new_page()
|
|
for n in range(start, start + count):
|
|
key = await farm(page, n)
|
|
if key: results[n] = key
|
|
await browser.close()
|
|
with open("firecrawl_100_keys.txt", "w") as f:
|
|
for n, key in sorted(results.items()):
|
|
f.write(f"{BASE}+firecrawl{n}@gmail.com|{key}|THESKIP\n")
|
|
print(f"\nDONE: {len(results)}/{count}")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main()) |