Update app.py
Browse files
app.py
CHANGED
@@ -567,6 +567,7 @@ def is_threads_url(url: str) -> bool:
|
|
567 |
"""Validate if URL is a valid Threads URL"""
|
568 |
try:
|
569 |
parsed = urlparse(url)
|
|
|
570 |
# Check if netloc matches known Threads domains
|
571 |
if parsed.netloc not in ['threads.net', 'www.threads.net', 'threads.com', 'www.threads.com']:
|
572 |
return False
|
@@ -625,7 +626,7 @@ async def multi_download(request: Request):
|
|
625 |
if is_threads_url(video_url):
|
626 |
return call_extract_endpoint(video_url)
|
627 |
|
628 |
-
if is_youtube_url:
|
629 |
dl_url = get_youtube_download_url_from_apis(video_url)
|
630 |
if dl_url:
|
631 |
return {"url": dl_url, "requests_remaining": rate_limiter.max_requests - rate_limiter.get_current_count(user_ip)}
|
@@ -633,7 +634,7 @@ async def multi_download(request: Request):
|
|
633 |
return {
|
634 |
"error": "Failed to Fetch the video."
|
635 |
}
|
636 |
-
'''encoded_url = urllib.parse.quote(str(video_url), safe='')
|
637 |
dl_url = f'https://chrunos-grab.hf.space/yt/dl?url={encoded_url}&{parameter}'
|
638 |
if dl_url and "http" in dl_url:
|
639 |
return {"url": dl_url, "requests_remaining": rate_limiter.max_requests - rate_limiter.get_current_count(user_ip)}
|
|
|
567 |
"""Validate if URL is a valid Threads URL"""
|
568 |
try:
|
569 |
parsed = urlparse(url)
|
570 |
+
logger.info(parsed)
|
571 |
# Check if netloc matches known Threads domains
|
572 |
if parsed.netloc not in ['threads.net', 'www.threads.net', 'threads.com', 'www.threads.com']:
|
573 |
return False
|
|
|
626 |
if is_threads_url(video_url):
|
627 |
return call_extract_endpoint(video_url)
|
628 |
|
629 |
+
'''if is_youtube_url:
|
630 |
dl_url = get_youtube_download_url_from_apis(video_url)
|
631 |
if dl_url:
|
632 |
return {"url": dl_url, "requests_remaining": rate_limiter.max_requests - rate_limiter.get_current_count(user_ip)}
|
|
|
634 |
return {
|
635 |
"error": "Failed to Fetch the video."
|
636 |
}
|
637 |
+
''''''encoded_url = urllib.parse.quote(str(video_url), safe='')
|
638 |
dl_url = f'https://chrunos-grab.hf.space/yt/dl?url={encoded_url}&{parameter}'
|
639 |
if dl_url and "http" in dl_url:
|
640 |
return {"url": dl_url, "requests_remaining": rate_limiter.max_requests - rate_limiter.get_current_count(user_ip)}
|