Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -412,18 +412,18 @@ def download_video_with_ytdlp(url):
|
|
| 412 |
|
| 413 |
def detect_video_source(url):
|
| 414 |
"""Detect video source and determine download method"""
|
| 415 |
-
#
|
| 416 |
-
if
|
| 417 |
-
return "direct_video"
|
| 418 |
-
|
| 419 |
-
# Known platforms with direct download support
|
| 420 |
-
if "image.civitai.com" in url:
|
| 421 |
-
return "civitai"
|
| 422 |
-
elif "cdn.midjourney.com" in url or "midjourney" in url.lower():
|
| 423 |
return "midjourney"
|
|
|
|
|
|
|
| 424 |
elif "v21-kling.klingai.com" in url or "kling.ai" in url:
|
| 425 |
return "kling"
|
| 426 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 427 |
# Popular video platforms (use yt-dlp)
|
| 428 |
elif any(platform in url.lower() for platform in [
|
| 429 |
'youtube.com', 'youtu.be', 'vimeo.com', 'dailymotion.com',
|
|
@@ -1114,4 +1114,4 @@ if __name__ == "__main__":
|
|
| 1114 |
server_name="0.0.0.0",
|
| 1115 |
server_port=7860,
|
| 1116 |
show_error=True
|
| 1117 |
-
)
|
|
|
|
| 412 |
|
| 413 |
def detect_video_source(url):
|
| 414 |
"""Detect video source and determine download method"""
|
| 415 |
+
# Known platforms with special handling (priority check first)
|
| 416 |
+
if "cdn.midjourney.com" in url or "midjourney" in url.lower():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 417 |
return "midjourney"
|
| 418 |
+
elif "image.civitai.com" in url:
|
| 419 |
+
return "civitai"
|
| 420 |
elif "v21-kling.klingai.com" in url or "kling.ai" in url:
|
| 421 |
return "kling"
|
| 422 |
|
| 423 |
+
# Direct video file URLs (check after platform-specific URLs)
|
| 424 |
+
elif any(ext in url.lower() for ext in ['.mp4', '.webm', '.mov', '.avi', '.mkv']):
|
| 425 |
+
return "direct_video"
|
| 426 |
+
|
| 427 |
# Popular video platforms (use yt-dlp)
|
| 428 |
elif any(platform in url.lower() for platform in [
|
| 429 |
'youtube.com', 'youtu.be', 'vimeo.com', 'dailymotion.com',
|
|
|
|
| 1114 |
server_name="0.0.0.0",
|
| 1115 |
server_port=7860,
|
| 1116 |
show_error=True
|
| 1117 |
+
)
|