Skip to content
Advertisement

Get URL of downloaded video in youtube_dl progress hook

How can I get the URL of a video that I’m downloading using youtube_dl?

I can use progress hooks to get other characteristics of the download, like the file path:

JavaScript

I also want to get the URL that the file came from. I can’t figure out how to do that. Something like url = response["url"] would be good, but there aren’t very many options with progress hooks.

Advertisement

Answer

Since there doesn’t seem to be a way to do this, I restructured my program to only download one at a time, so it was very explicit to me which was being downloaded.

To use this, you create an instance of it, passing the list of URLs you want to download to the constructor.

Then, when you’re ready, you can call start_download_process on the object. It will wait until the current track is finished and the progress_hook is fully done before downloading another.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement