Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -95,17 +95,22 @@ async def get_best_available_transcript(video_id):
|
|
95 |
YouTube λΉλμ€μ μλ§μ κ°μ Έμ΅λλ€.
|
96 |
"""
|
97 |
try:
|
98 |
-
#
|
99 |
-
transcript = YouTubeTranscriptApi.get_transcript(video_id, languages=['
|
100 |
except Exception as e:
|
101 |
-
logging.warning(f'Error fetching
|
102 |
try:
|
103 |
-
#
|
104 |
-
|
105 |
-
transcript = transcripts.find_manually_created_transcript(['ko', 'ja', 'zh-Hans', 'zh-Hant']).fetch()
|
106 |
except Exception as e:
|
107 |
-
logging.
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
# μλ§ ν¬λ§·ν
|
111 |
formatter = TextFormatter()
|
|
|
95 |
YouTube λΉλμ€μ μλ§μ κ°μ Έμ΅λλ€.
|
96 |
"""
|
97 |
try:
|
98 |
+
# νκ΅μ΄ μλ§ μλ
|
99 |
+
transcript = YouTubeTranscriptApi.get_transcript(video_id, languages=['ko'])
|
100 |
except Exception as e:
|
101 |
+
logging.warning(f'Error fetching Korean transcript: {e}')
|
102 |
try:
|
103 |
+
# νκ΅μ΄ μλ§μ΄ μμΌλ©΄ μμ΄ μλ§ μλ
|
104 |
+
transcript = YouTubeTranscriptApi.get_transcript(video_id, languages=['en'])
|
|
|
105 |
except Exception as e:
|
106 |
+
logging.warning(f'Error fetching English transcript: {e}')
|
107 |
+
try:
|
108 |
+
# μμ΄ μλ§λ μμΌλ©΄ λ€λ₯Έ μΈμ΄ μλ§ μλ
|
109 |
+
transcripts = YouTubeTranscriptApi.list_transcripts(video_id)
|
110 |
+
transcript = transcripts.find_manually_created_transcript().fetch()
|
111 |
+
except Exception as e:
|
112 |
+
logging.error(f'Error fetching alternative transcript: {e}')
|
113 |
+
return None
|
114 |
|
115 |
# μλ§ ν¬λ§·ν
|
116 |
formatter = TextFormatter()
|