I have the following code that download xml file with the subtitle of a video from YouTube
Sub Test()
Dim http As Object
Dim oStream As Object
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "GET", "http://video.google.com/timedtext?lang=en&v=qANA6POtuFo", False
http.send
Set oStream = CreateObject("ADODB.Stream")
oStream.Open
oStream.Type = 1
oStream.Write http.responseBody
oStream.SaveToFile ThisWorkbook.Path & "\Sample.xml", 2
oStream.Close
End Sub
But it doesn't work for other videos for example I tried this link v=4Z3EJrh7_5k
Any idea how to do the download with any video with a subtitle?
YouTube offers viewers the option to download a video's subtitles as text, provided that the video's creator has already added those subtitles to their video file.
Select the pencil icon (Details) for the video you want to edit. Select Subtitles and Click on EDIT. To download the subtitles (caption) without the time stamp, click EDIT AS TEXT. Note: To download the subtitles with time stamp, click 3 dots next to “Edit as Text.”
As far as I researched, you cannot download from 4Z3EJrh7_5k
because it's subtitle is not a file someone uploaded, but it is generated automatically.
To see if a video has any subtitle file, you can use http://video.google.com/timedtext?type=list&v=qANA6POtuFo
, and it will list every file with languages inserted in the video. You can note that it shows only one, even if you go to the video and click, there are two (English and English (Automatically generated))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With