Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,9 +56,6 @@ def download_audio(url):
|
|
| 56 |
'no_warnings': True,
|
| 57 |
'extract_flat': False,
|
| 58 |
'ignoreerrors': False,
|
| 59 |
-
'noplaylist': True,
|
| 60 |
-
'force_generic_extractor': False,
|
| 61 |
-
|
| 62 |
# Add user agent to avoid bot detection
|
| 63 |
'http_headers': {
|
| 64 |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
|
|
@@ -154,20 +151,17 @@ def test_video_access(url):
|
|
| 154 |
'no_warnings': True,
|
| 155 |
'extract_flat': False,
|
| 156 |
'skip_download': True,
|
| 157 |
-
'noplaylist': True,
|
| 158 |
-
'force_generic_extractor': False,
|
| 159 |
-
'extractor_args': {'youtubetab': 'skip=authcheck'} # ✅ ADD THIS LINE
|
| 160 |
}
|
| 161 |
-
|
| 162 |
if cookies_path:
|
| 163 |
ydl_opts['cookiefile'] = cookies_path
|
| 164 |
-
|
| 165 |
with YoutubeDL(ydl_opts) as ydl:
|
| 166 |
info_dict = ydl.extract_info(url, download=False)
|
| 167 |
-
|
| 168 |
status = "✅ Video accessible"
|
| 169 |
details = []
|
| 170 |
-
|
| 171 |
if info_dict.get('title'):
|
| 172 |
details.append(f"Title: {info_dict['title'][:50]}...")
|
| 173 |
if info_dict.get('duration'):
|
|
@@ -176,9 +170,9 @@ def test_video_access(url):
|
|
| 176 |
details.append(f"Availability: {info_dict['availability']}")
|
| 177 |
if info_dict.get('age_limit'):
|
| 178 |
details.append(f"Age limit: {info_dict['age_limit']}+")
|
| 179 |
-
|
| 180 |
return status + "\n" + "\n".join(details)
|
| 181 |
-
|
| 182 |
except Exception as e:
|
| 183 |
return f"❌ Video access test failed: {str(e)}"
|
| 184 |
|
|
|
|
| 56 |
'no_warnings': True,
|
| 57 |
'extract_flat': False,
|
| 58 |
'ignoreerrors': False,
|
|
|
|
|
|
|
|
|
|
| 59 |
# Add user agent to avoid bot detection
|
| 60 |
'http_headers': {
|
| 61 |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
|
|
|
|
| 151 |
'no_warnings': True,
|
| 152 |
'extract_flat': False,
|
| 153 |
'skip_download': True,
|
|
|
|
|
|
|
|
|
|
| 154 |
}
|
| 155 |
+
|
| 156 |
if cookies_path:
|
| 157 |
ydl_opts['cookiefile'] = cookies_path
|
| 158 |
+
|
| 159 |
with YoutubeDL(ydl_opts) as ydl:
|
| 160 |
info_dict = ydl.extract_info(url, download=False)
|
| 161 |
+
|
| 162 |
status = "✅ Video accessible"
|
| 163 |
details = []
|
| 164 |
+
|
| 165 |
if info_dict.get('title'):
|
| 166 |
details.append(f"Title: {info_dict['title'][:50]}...")
|
| 167 |
if info_dict.get('duration'):
|
|
|
|
| 170 |
details.append(f"Availability: {info_dict['availability']}")
|
| 171 |
if info_dict.get('age_limit'):
|
| 172 |
details.append(f"Age limit: {info_dict['age_limit']}+")
|
| 173 |
+
|
| 174 |
return status + "\n" + "\n".join(details)
|
| 175 |
+
|
| 176 |
except Exception as e:
|
| 177 |
return f"❌ Video access test failed: {str(e)}"
|
| 178 |
|