Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ from playwright.async_api import async_playwright
|
|
| 3 |
|
| 4 |
app = FastAPI()
|
| 5 |
|
| 6 |
-
# Your
|
| 7 |
BEARER = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY5M2NmYTBkMGU4YzlmMzdiZTA4Y2IyMCIsImlhdCI6MTczMjM5NTc5OSwiZXhwIjoxNzczMDAwNTk5fQ.Mc-LS_NMe0lpBQrQE4DEGs83iVBHIp8LvzBdeaUbmHo"
|
| 8 |
|
| 9 |
@app.get("/")
|
|
@@ -14,43 +14,51 @@ def home():
|
|
| 14 |
async def do_react(url: str, emojis: str):
|
| 15 |
try:
|
| 16 |
async with async_playwright() as p:
|
| 17 |
-
# Open invisible Chrome
|
| 18 |
browser = await p.chromium.launch(headless=True)
|
| 19 |
context = await browser.new_context(
|
| 20 |
-
# Inject your token into every request to bypass login
|
| 21 |
-
extra_http_headers={"Authorization": f"Bearer {BEARER}"},
|
| 22 |
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
| 23 |
)
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
page = await context.new_page()
|
| 26 |
|
| 27 |
# Go to the website
|
| 28 |
await page.goto("https://asitha.top/channel-react", wait_until="networkidle")
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
| 34 |
|
| 35 |
-
#
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
|
|
|
| 39 |
await page.wait_for_timeout(500)
|
| 40 |
-
await
|
| 41 |
await page.wait_for_timeout(500)
|
| 42 |
|
| 43 |
# Click the yellow button!
|
| 44 |
-
await page.
|
| 45 |
|
| 46 |
-
# Wait 4 seconds for the
|
| 47 |
await page.wait_for_timeout(4000)
|
| 48 |
|
| 49 |
await browser.close()
|
| 50 |
return {"success": True, "message": "Reaction injected successfully!"}
|
| 51 |
else:
|
| 52 |
await browser.close()
|
| 53 |
-
return {"success": False, "error": "
|
| 54 |
|
| 55 |
except Exception as e:
|
| 56 |
return {"success": False, "error": str(e)}
|
|
|
|
| 3 |
|
| 4 |
app = FastAPI()
|
| 5 |
|
| 6 |
+
# Your 2026 Token
|
| 7 |
BEARER = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY5M2NmYTBkMGU4YzlmMzdiZTA4Y2IyMCIsImlhdCI6MTczMjM5NTc5OSwiZXhwIjoxNzczMDAwNTk5fQ.Mc-LS_NMe0lpBQrQE4DEGs83iVBHIp8LvzBdeaUbmHo"
|
| 8 |
|
| 9 |
@app.get("/")
|
|
|
|
| 14 |
async def do_react(url: str, emojis: str):
|
| 15 |
try:
|
| 16 |
async with async_playwright() as p:
|
|
|
|
| 17 |
browser = await p.chromium.launch(headless=True)
|
| 18 |
context = await browser.new_context(
|
|
|
|
|
|
|
| 19 |
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
| 20 |
)
|
| 21 |
|
| 22 |
+
# 🟢 PROPER COOKIE INJECTION (Forces the browser to be logged in)
|
| 23 |
+
await context.add_cookies([{
|
| 24 |
+
"name": "ain",
|
| 25 |
+
"value": BEARER,
|
| 26 |
+
"domain": "asitha.top",
|
| 27 |
+
"path": "/"
|
| 28 |
+
}])
|
| 29 |
+
|
| 30 |
page = await context.new_page()
|
| 31 |
|
| 32 |
# Go to the website
|
| 33 |
await page.goto("https://asitha.top/channel-react", wait_until="networkidle")
|
| 34 |
|
| 35 |
+
# Wait for the Pay button to appear (Proves we successfully bypassed login)
|
| 36 |
+
try:
|
| 37 |
+
await page.wait_for_selector("button:has-text('Pay 1 COIN')", timeout=10000)
|
| 38 |
+
except:
|
| 39 |
+
await browser.close()
|
| 40 |
+
return {"success": False, "error": "Login failed. The bot is stuck on the Google Login screen."}
|
| 41 |
|
| 42 |
+
# Grab all input boxes (Bypasses the 'type=url' bug)
|
| 43 |
+
inputs = await page.locator("input").all()
|
| 44 |
+
|
| 45 |
+
if len(inputs) >= 2:
|
| 46 |
+
await inputs[0].fill(url)
|
| 47 |
await page.wait_for_timeout(500)
|
| 48 |
+
await inputs[1].fill(emojis)
|
| 49 |
await page.wait_for_timeout(500)
|
| 50 |
|
| 51 |
# Click the yellow button!
|
| 52 |
+
await page.locator("button:has-text('Pay 1 COIN')").click()
|
| 53 |
|
| 54 |
+
# Wait 4 seconds for the server to process the reactions
|
| 55 |
await page.wait_for_timeout(4000)
|
| 56 |
|
| 57 |
await browser.close()
|
| 58 |
return {"success": True, "message": "Reaction injected successfully!"}
|
| 59 |
else:
|
| 60 |
await browser.close()
|
| 61 |
+
return {"success": False, "error": f"Found {len(inputs)} inputs instead of 2."}
|
| 62 |
|
| 63 |
except Exception as e:
|
| 64 |
return {"success": False, "error": str(e)}
|