thanakon48155 commited on
Commit
249f596
·
verified ·
1 Parent(s): 38a3c00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -6,11 +6,13 @@ import logging
6
  import asyncio
7
  from playwright.async_api import async_playwright
8
 
9
- # รองรับ playwright-stealth ทุกเวอร์ชัน (แก้บั๊ก Runtime Error)
10
- try:
11
- from playwright_stealth import stealth_async as stealth
12
- except ImportError:
13
- from playwright_stealth import stealth
 
 
14
 
15
  app = FastAPI(title="OpenNovel Proxy Server")
16
  logging.basicConfig(level=logging.INFO)
@@ -37,8 +39,8 @@ def index():
37
  <html>
38
  <head><meta charset="utf-8"><style>body { font-family: sans-serif; background: #f9fafb; max-width: 600px; margin: 80px auto; padding: 30px; border-radius: 16px; background: white; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); } h1 { color: #4f46e5; } code { background: #f3f4f6; padding: 4px 8px; border-radius: 6px; font-family: monospace; color: #db2777; } .status { color: #10b981; font-weight: bold; margin-bottom: 20px; }</style></head>
39
  <body>
40
- <h1>OpenNovel Proxy Server V4 🚀</h1>
41
- <div class="status">🟢 Online (แก้ไขบั๊กเวอร์ชัน และอัปเกรดระบบ AI Stealth ทะลุ Cloudflare ระดับสูงสุด)</div>
42
  </body>
43
  </html>
44
  """
@@ -71,7 +73,7 @@ async def scrape(url: str = Query(..., description="The manga URL to scrape")):
71
  page = await context.new_page()
72
 
73
  # ใช้งานโหมด Stealth เพื่อหลบการตรวจจับบอทขั้นสุด
74
- await stealth(page)
75
 
76
  # เปิดหน้าเว็บ
77
  await page.goto(url, wait_until="domcontentloaded", timeout=45000)
 
6
  import asyncio
7
  from playwright.async_api import async_playwright
8
 
9
+ async def apply_stealth(page):
10
+ try:
11
+ from playwright_stealth import stealth_async
12
+ await stealth_async(page)
13
+ except ImportError:
14
+ from playwright_stealth import Stealth
15
+ await Stealth().apply_stealth_async(page)
16
 
17
  app = FastAPI(title="OpenNovel Proxy Server")
18
  logging.basicConfig(level=logging.INFO)
 
39
  <html>
40
  <head><meta charset="utf-8"><style>body { font-family: sans-serif; background: #f9fafb; max-width: 600px; margin: 80px auto; padding: 30px; border-radius: 16px; background: white; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); } h1 { color: #4f46e5; } code { background: #f3f4f6; padding: 4px 8px; border-radius: 6px; font-family: monospace; color: #db2777; } .status { color: #10b981; font-weight: bold; margin-bottom: 20px; }</style></head>
41
  <body>
42
+ <h1>OpenNovel Proxy Server V5 🚀</h1>
43
+ <div class="status">🟢 Online (แก้ไขบั๊กและอัปเกรดระบบ AI Stealth สมบูรณ์ 100%)</div>
44
  </body>
45
  </html>
46
  """
 
73
  page = await context.new_page()
74
 
75
  # ใช้งานโหมด Stealth เพื่อหลบการตรวจจับบอทขั้นสุด
76
+ await apply_stealth(page)
77
 
78
  # เปิดหน้าเว็บ
79
  await page.goto(url, wait_until="domcontentloaded", timeout=45000)