Update app.py
Browse files
app.py
CHANGED
@@ -597,7 +597,7 @@ async def multi_download(request: Request):
|
|
597 |
|
598 |
is_youtube_url = re.search(r'(youtube\.com|youtu\.be)', video_url) is not None
|
599 |
|
600 |
-
if is_youtube_url:
|
601 |
dl_url = get_youtube_download_url_from_apis(video_url)
|
602 |
if dl_url:
|
603 |
return {"url": dl_url, "requests_remaining": rate_limiter.max_requests - rate_limiter.get_current_count(user_ip)}
|
@@ -605,25 +605,26 @@ async def multi_download(request: Request):
|
|
605 |
return {
|
606 |
"error": "Failed to Fetch the video."
|
607 |
}
|
608 |
-
|
609 |
dl_url = f'https://chrunos-grab.hf.space/yt/dl?url={encoded_url}&{parameter}'
|
610 |
if dl_url and "http" in dl_url:
|
611 |
return {"url": dl_url, "requests_remaining": rate_limiter.max_requests - rate_limiter.get_current_count(user_ip)}
|
612 |
else:
|
613 |
return {
|
614 |
"error": "Failed to Fetch the video."
|
615 |
-
}
|
616 |
|
617 |
else:
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
|
|
627 |
|
628 |
|
629 |
|
|
|
597 |
|
598 |
is_youtube_url = re.search(r'(youtube\.com|youtu\.be)', video_url) is not None
|
599 |
|
600 |
+
'''if is_youtube_url:
|
601 |
dl_url = get_youtube_download_url_from_apis(video_url)
|
602 |
if dl_url:
|
603 |
return {"url": dl_url, "requests_remaining": rate_limiter.max_requests - rate_limiter.get_current_count(user_ip)}
|
|
|
605 |
return {
|
606 |
"error": "Failed to Fetch the video."
|
607 |
}
|
608 |
+
encoded_url = urllib.parse.quote(str(video_url), safe='')
|
609 |
dl_url = f'https://chrunos-grab.hf.space/yt/dl?url={encoded_url}&{parameter}'
|
610 |
if dl_url and "http" in dl_url:
|
611 |
return {"url": dl_url, "requests_remaining": rate_limiter.max_requests - rate_limiter.get_current_count(user_ip)}
|
612 |
else:
|
613 |
return {
|
614 |
"error": "Failed to Fetch the video."
|
615 |
+
}
|
616 |
|
617 |
else:
|
618 |
+
'''
|
619 |
+
dl_url = await get_track_download_url(video_url, quality)
|
620 |
+
if dl_url:
|
621 |
+
remaining_requests_value = rate_limiter.max_requests - rate_limiter.get_current_count(user_ip)
|
622 |
+
dl_url["requests_remaining"] = remaining_requests_value
|
623 |
+
return dl_url
|
624 |
+
else:
|
625 |
+
return {
|
626 |
+
"error": "Failed to Fetch the video."
|
627 |
+
}
|
628 |
|
629 |
|
630 |
|