Saturday, August 4, 2018

Download YouTube subtitles using excel vba

Leave a Comment

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?

1 Answers

Answers 1

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 Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment