• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Download youtube subtitle

YasserKhalil

Well-Known Member
Hello everyone

I am following manual steps to download subtitles from youtube
1- Copy the YouTube video link to google chrome
2- Press Ctrl + Shift + I (Developers Tools)
3- Click 'Network'
4- Play the video and click on "CC" to display the closed captions (subtitle of the video)
5- from 'Network' Tab >> Right-Click on the header 'timedtext?.." and open in new tab
6- in the new tab >> Right-Click and 'Save As' and save the xml file

* Here's an example of a video
Code:
https://www.youtube.com/watch?v=qANA6POtuFo
How can I achieve those steps using VBA ..?

Thanks advanced for help
 

YasserKhalil

Well-Known Member
Thank you very very much for the links .. I have made use of the stackoverflow link and could get the url of the xml file of the video and I used the following code to download it
Code:
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
Best Regards
 

YasserKhalil

Well-Known Member
I have encountered run-time error when trying this link
Code:
http://video.google.com/timedtext?lang=en&v=_kjSK-PcU9o
Untitled.png
 

Marc L

Excel Ninja

Of course but not on my side even if I can see text rolling on video …

I should test on a more recent version when I could borrow a laptop,
maybe next week or the other week …
 

Chihiro

Excel Ninja
FYI - Some CC are done without list file and can't be down loaded.
Video from post #6 is one such example. You can test by...
http://video.google.com/timedtext?type=list&v=_kjSK-PcU9o

Basically these captions are done via automatic speech recognition (asr) and there is no file to download via video.google.com.

For these, I believe you'd need to pilot browser or use some other method (I'd recommend using tool other than VBA).

Edit: Alternately you could use Julius or other speech recognition engine to transcribe. But then this is fun project, but not easy ;)
 

SissyT

New Member
Anyone knows how to download video with the subtitle embedded??? I've tried many online downloaders and they all failed to do so, only getting a pure video with no subtitle at all. So I have to use my RecMaster recorder to keep a copy of the video with cc displaying on the image. The only advantage of this method is that I can directly cut some unwanted segments off during recording...
 

vletm

Excel Ninja
SissyT
You should reread Forum Rules
There has written: Start a new post every time you ask a question, even if the theme is similar.
 
Top