Update youtube_worksheet.py
Browse files- youtube_worksheet.py +7 -2
youtube_worksheet.py
CHANGED
|
@@ -19,10 +19,15 @@ class YouTubeWorksheet:
|
|
| 19 |
if not video_id:
|
| 20 |
return None
|
| 21 |
try:
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
except Exception as e:
|
| 25 |
print(f"μλ§ μΆμΆ μ€λ₯: {e}")
|
|
|
|
| 26 |
return None
|
| 27 |
|
| 28 |
def create_worksheet(self, transcript):
|
|
|
|
| 19 |
if not video_id:
|
| 20 |
return None
|
| 21 |
try:
|
| 22 |
+
# μ¬μ© κ°λ₯ν λͺ¨λ μλ§ λͺ©λ‘μ λ¨Όμ νμΈ
|
| 23 |
+
transcript_list = YouTubeTranscriptApi.list_transcripts(video_id)
|
| 24 |
+
|
| 25 |
+
# μλ μμ±λ μλ§ ν¬ν¨νμ¬ μλ
|
| 26 |
+
transcript = transcript_list.find_transcript(['en', 'ko'])
|
| 27 |
+
return ' '.join([entry['text'] for entry in transcript.fetch()])
|
| 28 |
except Exception as e:
|
| 29 |
print(f"μλ§ μΆμΆ μ€λ₯: {e}")
|
| 30 |
+
print(f"λΉλμ€ ID: {video_id}")
|
| 31 |
return None
|
| 32 |
|
| 33 |
def create_worksheet(self, transcript):
|