Spaces:
Sleeping
Sleeping
Update src/tools/accent_tool.py
Browse files- src/tools/accent_tool.py +13 -1
src/tools/accent_tool.py
CHANGED
@@ -41,7 +41,18 @@ class AccentAnalyzerTool:
|
|
41 |
|
42 |
video_path = os.path.join(tmp_dir, "video.mp4")
|
43 |
|
44 |
-
headers = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
r = requests.get(url, headers=headers, stream=True)
|
46 |
r.raise_for_status()
|
47 |
with open(video_path, "wb") as f:
|
@@ -49,6 +60,7 @@ class AccentAnalyzerTool:
|
|
49 |
if chunk:
|
50 |
f.write(chunk)
|
51 |
|
|
|
52 |
file_size = os.path.getsize(video_path)
|
53 |
self.log(f"Downloaded video size: {file_size} bytes")
|
54 |
if file_size < 1000:
|
|
|
41 |
|
42 |
video_path = os.path.join(tmp_dir, "video.mp4")
|
43 |
|
44 |
+
headers = {
|
45 |
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
46 |
+
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
47 |
+
"Chrome/114.0.0.0 Safari/537.36",
|
48 |
+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,"
|
49 |
+
"image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
|
50 |
+
"Accept-Language": "en-US,en;q=0.9",
|
51 |
+
"Referer": "https://www.youtube.com/",
|
52 |
+
"Connection": "keep-alive",
|
53 |
+
"DNT": "1",
|
54 |
+
}
|
55 |
+
|
56 |
r = requests.get(url, headers=headers, stream=True)
|
57 |
r.raise_for_status()
|
58 |
with open(video_path, "wb") as f:
|
|
|
60 |
if chunk:
|
61 |
f.write(chunk)
|
62 |
|
63 |
+
|
64 |
file_size = os.path.getsize(video_path)
|
65 |
self.log(f"Downloaded video size: {file_size} bytes")
|
66 |
if file_size < 1000:
|