Update app.py
Browse files
app.py
CHANGED
@@ -29,13 +29,6 @@ def fetch_html(url: str):
|
|
29 |
# Modify the goto call with options
|
30 |
page.goto(url, timeout=15000, wait_until="networkidle")
|
31 |
|
32 |
-
# Check if the content is an image
|
33 |
-
content_type = page.content_type()
|
34 |
-
if "image" in content_type:
|
35 |
-
image_bytes = page.screenshot() # Capture the image if it's an image page
|
36 |
-
browser.close()
|
37 |
-
return Response(content=image_bytes, media_type=content_type)
|
38 |
-
|
39 |
# Otherwise, return the HTML content
|
40 |
html = page.content()
|
41 |
browser.close()
|
|
|
29 |
# Modify the goto call with options
|
30 |
page.goto(url, timeout=15000, wait_until="networkidle")
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
# Otherwise, return the HTML content
|
33 |
html = page.content()
|
34 |
browser.close()
|