The first file you try to run, youtube2srt.py, is actually youtube2srt.rb and is a ruby file - not python.
The second probably requires you to install the package BeautifulSoup, which is not included in the standard python library
题
it is possible to get XML code of Youtube closed caption in this URL:
http://video.google.com/timedtext?hl=en&lang=en&v=VIDEO_ID
which VIDEO_ID is youtube video ID. to convert that code into srt file I used this script:
https://gist.github.com/golive/129171
which is a python code. for running python code I used
C:\Python27\python youtube2srt.py
according to this:
Python - How do you run a .py file?
I copied that code into a file named youtube2srt.py. I saved XML codes of that page to a file as youtube_xml.xml.
when I run it I receive this error:
when I delete two first lines & run it, I get this error:
I have almost the same problem with this code:
https://gist.github.com/gorlum0/1290835
what's the problem?!
解决方案
The first file you try to run, youtube2srt.py, is actually youtube2srt.rb and is a ruby file - not python.
The second probably requires you to install the package BeautifulSoup, which is not included in the standard python library