Hana Celeste commited on
Update app/byps_logic.py
Browse files- app/byps_logic.py +4 -4
app/byps_logic.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import asyncio
|
| 2 |
import random
|
| 3 |
from playwright.async_api import async_playwright
|
| 4 |
-
from playwright_stealth import
|
| 5 |
|
| 6 |
|
| 7 |
class BypsApp:
|
|
@@ -50,7 +50,8 @@ class BypsApp:
|
|
| 50 |
|
| 51 |
page = await context.new_page()
|
| 52 |
|
| 53 |
-
|
|
|
|
| 54 |
|
| 55 |
await page.goto(url, wait_until="domcontentloaded", timeout=60000)
|
| 56 |
|
|
@@ -81,8 +82,7 @@ class BypsApp:
|
|
| 81 |
)
|
| 82 |
await asyncio.sleep(3)
|
| 83 |
|
| 84 |
-
|
| 85 |
-
return {"ok": True, "data": content}
|
| 86 |
|
| 87 |
except Exception as e:
|
| 88 |
return {"ok": False, "error": str(e)}
|
|
|
|
| 1 |
import asyncio
|
| 2 |
import random
|
| 3 |
from playwright.async_api import async_playwright
|
| 4 |
+
from playwright_stealth import stealth
|
| 5 |
|
| 6 |
|
| 7 |
class BypsApp:
|
|
|
|
| 50 |
|
| 51 |
page = await context.new_page()
|
| 52 |
|
| 53 |
+
# ✅ QUAN TRỌNG: KHÔNG await
|
| 54 |
+
stealth(page)
|
| 55 |
|
| 56 |
await page.goto(url, wait_until="domcontentloaded", timeout=60000)
|
| 57 |
|
|
|
|
| 82 |
)
|
| 83 |
await asyncio.sleep(3)
|
| 84 |
|
| 85 |
+
return {"ok": True, "data": await page.content()}
|
|
|
|
| 86 |
|
| 87 |
except Exception as e:
|
| 88 |
return {"ok": False, "error": str(e)}
|