Spaces:
Runtime error
Runtime error
bufix transcriptsdisabled
Browse files
app.py
CHANGED
|
@@ -205,14 +205,29 @@ def get_videos_from_yt(yt):
|
|
| 205 |
|
| 206 |
return df_videos
|
| 207 |
|
| 208 |
-
def get_transcript(video_id):
|
| 209 |
-
|
| 210 |
-
transcript_list = yta.list_transcripts(video_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
|
| 212 |
transcript_raw = None
|
| 213 |
try:
|
|
|
|
| 214 |
transcript_item = transcript_list.find_transcript(['en'])
|
| 215 |
-
except NoTranscriptFound:
|
| 216 |
transcript_item = None
|
| 217 |
transcript_text = None
|
| 218 |
transcript_item_is_generated = False
|
|
|
|
| 205 |
|
| 206 |
return df_videos
|
| 207 |
|
| 208 |
+
def get_transcript(video_id):
|
| 209 |
+
|
| 210 |
+
# transcript_list = yta.list_transcripts(video_id)
|
| 211 |
+
# # iterate over all available transcripts
|
| 212 |
+
# for transcript in transcript_list:
|
| 213 |
+
# # the Transcript object provides metadata properties
|
| 214 |
+
# st.write(
|
| 215 |
+
# transcript.video_id,
|
| 216 |
+
# transcript.language,
|
| 217 |
+
# transcript.language_code,
|
| 218 |
+
# # whether it has been manually created or generated by YouTube
|
| 219 |
+
# transcript.is_generated,
|
| 220 |
+
# # whether this transcript can be translated or not
|
| 221 |
+
# transcript.is_translatable,
|
| 222 |
+
# # a list of languages the transcript can be translated to
|
| 223 |
+
# transcript.translation_languages,
|
| 224 |
+
# )
|
| 225 |
|
| 226 |
transcript_raw = None
|
| 227 |
try:
|
| 228 |
+
transcript_list = yta.list_transcripts(video_id)
|
| 229 |
transcript_item = transcript_list.find_transcript(['en'])
|
| 230 |
+
except (NoTranscriptFound, TranscriptsDisabled) as e:
|
| 231 |
transcript_item = None
|
| 232 |
transcript_text = None
|
| 233 |
transcript_item_is_generated = False
|