-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
25 lines (20 loc) · 681 Bytes
/
main.py
File metadata and controls
25 lines (20 loc) · 681 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from youtube_transcript_api import YouTubeTranscriptApi
def main():
try:
transcript = YouTubeTranscriptApi.get_transcript(
"yE3kwHfeDaQ",
proxies={
"https": "socks5://localhost:9050",
"http": "socks5://localhost:9050"
}
)
for entry in transcript:
start_time = entry['start']
minutes = int(start_time // 60)
seconds = int(start_time % 60)
text = entry['text']
print(f"{minutes:02}:{seconds:02} {text}")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
main()