add UA headers to gif download
Browse files
app.py
CHANGED
|
@@ -407,7 +407,7 @@ async def resolve_media_to_frames(media_input: str) -> List[Image.Image]:
|
|
| 407 |
if media_input.startswith("http://") or media_input.startswith("https://"):
|
| 408 |
hint = media_input
|
| 409 |
session = await get_http_session()
|
| 410 |
-
async with session.get(media_input) as resp:
|
| 411 |
if resp.status != 200:
|
| 412 |
raise HTTPException(status_code=400, detail=f"download_failed: HTTP {resp.status}")
|
| 413 |
# check content-length
|
|
|
|
| 407 |
if media_input.startswith("http://") or media_input.startswith("https://"):
|
| 408 |
hint = media_input
|
| 409 |
session = await get_http_session()
|
| 410 |
+
async with session.get(media_input, headers={"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", "Accept": "*/*"}) as resp:
|
| 411 |
if resp.status != 200:
|
| 412 |
raise HTTPException(status_code=400, detail=f"download_failed: HTTP {resp.status}")
|
| 413 |
# check content-length
|