Update app.py
Browse files
app.py
CHANGED
@@ -12,8 +12,6 @@ def get_custom_headers(url: str):
|
|
12 |
"Connection": "keep-alive",
|
13 |
"Referer": url,
|
14 |
}
|
15 |
-
if "jannyai.com" in url:
|
16 |
-
headers["Host"] = "jannyai.com"
|
17 |
return headers
|
18 |
|
19 |
@app.get("/fetch")
|
@@ -28,9 +26,7 @@ def fetch_html(url: str):
|
|
28 |
page.set_extra_http_headers(headers)
|
29 |
|
30 |
# Modify the goto call with options
|
31 |
-
page.goto(url)
|
32 |
-
if "jannyai.com" in url:
|
33 |
-
page.wait_for_timeout(5000)
|
34 |
html = page.content()
|
35 |
browser.close()
|
36 |
return {"html": html}
|
|
|
12 |
"Connection": "keep-alive",
|
13 |
"Referer": url,
|
14 |
}
|
|
|
|
|
15 |
return headers
|
16 |
|
17 |
@app.get("/fetch")
|
|
|
26 |
page.set_extra_http_headers(headers)
|
27 |
|
28 |
# Modify the goto call with options
|
29 |
+
page.goto(url, timeout=15000, wait_until="networkidle")
|
|
|
|
|
30 |
html = page.content()
|
31 |
browser.close()
|
32 |
return {"html": html}
|