From 52be7bad5d863eecd14ace3a13c1ba3b45c505b0 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sat, 14 Dec 2024 14:24:21 +1300 Subject: [PATCH] switch to requests.get in generate_image_from_video_url #373 --- app/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/utils.py b/app/utils.py index 6b3bb600..14bfdc06 100644 --- a/app/utils.py +++ b/app/utils.py @@ -17,6 +17,7 @@ import math from urllib.parse import urlparse, parse_qs, urlencode from functools import wraps import flask +import requests from bs4 import BeautifulSoup, MarkupResemblesLocatorWarning import warnings import jwt @@ -1111,7 +1112,7 @@ def in_sorted_list(arr, target): # Makes a still image from a video url, without downloading the whole video file def generate_image_from_video_url(video_url, output_path, length=2): - response = httpx_client.get(video_url, stream=True, timeout=5, + response = requests.get(video_url, stream=True, timeout=5, headers={'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0'}) # Imgur requires a user agent content_type = response.headers.get('Content-Type') if content_type: