Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Issues with embedding youtube-dl in python, getting auto subtitles, and getting a filename #15262
Comments
|
And BTW, after changing searches around, I did see this: #10987 I could get filename that way. Then I have this:
|
|
Make sure you are using the latest version: run
youtube-dl --versionand ensure your version is 2018.01.14. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.Before submitting an issue make sure you have:
What is the purpose of your issue?
Reference purposes for embedding: https://github.com/rg3/youtube-dl/blob/master/README.md#embedding-youtube-dl
Reference options that can be used when embedding: https://github.com/rg3/youtube-dl/blob/3e4cedf9e8cd3157df2457df7274d0c842421945/youtube_dl/YoutubeDL.py#L137-L312
I am embedding youtube-dl into a python script.
I have this code currently:
I have spent several hours on this, across multiple days, without getting it to work the way I want. Ideally, this is what I want to happen:
A) I feed a URL
B) I get all the titles from the URL returned in a string/list (regular subtitles if they exist, if not that, then I want autogenerated)
C) I delete video file and titles files
The issues/things I don't understand with this:
my_hook gets called twice with d['status'] == 'finished' being True. I would expect it to only be called once. Maybe the second time is for the titles.
'keepvideo': False - I don't want to keep the video file, I only want the titles. I tried to set "simulate" to True as well, still kept video file. This isn't that big of a deal, mostly curious (I can manually delete the video file in python). Actually, nevermind, 'skip_download': True does what I want... it just keeps the en.vtt file. I think.
I want to get the filename of the resulting video file, or titles file for that matter (ideally the latter). I can't seem to get that... despite it being in the hook.
Once I have the name, I can change extension to titles and then read that in and do what I want... but simply getting filename in a way that works is proving difficult. I look forward to any insight.