Update app.py
Browse files
app.py
CHANGED
@@ -24,16 +24,15 @@ def extract_info(youtube_url):
|
|
24 |
|
25 |
formats = info.get('formats', [])
|
26 |
|
27 |
-
best_video_only =
|
28 |
-
key=lambda x: x.get('height', 0), default=None)
|
29 |
|
30 |
-
|
31 |
-
|
32 |
|
33 |
metadata_str = "\n".join([f"{k}: {v}" for k, v in metadata.items()])
|
34 |
|
35 |
video_only_link = f'<a href="{best_video_only["url"]}" target="_blank">비디오만 다운로드</a>' if best_video_only else ""
|
36 |
-
combined_link = f'<a href="{
|
37 |
|
38 |
download_links = f"{video_only_link}<br>{combined_link}" if video_only_link or combined_link else "다운로드 링크를 찾을 수 없습니다."
|
39 |
|
|
|
24 |
|
25 |
formats = info.get('formats', [])
|
26 |
|
27 |
+
best_video_only = next((f for f in formats if f['ext'] == 'mp4' and f.get('vcodec') != 'none' and f.get('acodec') == 'none'), None)
|
|
|
28 |
|
29 |
+
# 간단히 비디오와 오디오가 모두 있는 첫 번째 mp4 포맷을 선택
|
30 |
+
combined = next((f for f in formats if f['ext'] == 'mp4' and f.get('vcodec') != 'none' and f.get('acodec') != 'none'), None)
|
31 |
|
32 |
metadata_str = "\n".join([f"{k}: {v}" for k, v in metadata.items()])
|
33 |
|
34 |
video_only_link = f'<a href="{best_video_only["url"]}" target="_blank">비디오만 다운로드</a>' if best_video_only else ""
|
35 |
+
combined_link = f'<a href="{combined["url"]}" target="_blank">비디오+오디오 다운로드</a>' if combined else ""
|
36 |
|
37 |
download_links = f"{video_only_link}<br>{combined_link}" if video_only_link or combined_link else "다운로드 링크를 찾을 수 없습니다."
|
38 |
|