Python application integration #151

Closed
opened 2026-02-20 22:26:38 -05:00 by deekerman · 1 comment
Owner

Originally created by @sajal on GitHub (Nov 19, 2011).

Firstly ive seen #217 and looking forward to API-ification.

In the meantime, im using subprocess to call youtube-dl, but am curious on how my code can get the download progress.

Im running it like so

p = subprocess.Popen([yt_path, "http://www.youtube.com/watch?v=%s" %(ytid),  "-o", filename ], stdout=subprocess.PIPE)
com = p.communicate()

Here after the first line, it executes youtube-dl, only when it finishes the download, the next line is executed with the shell output. Is there a way I can regularly poll the subprocess for the latest shell output so my application can know what the progress is?

I understand this has more to do with subprocess than youtube-dl, but i figured some users may have already figured it out.

Originally created by @sajal on GitHub (Nov 19, 2011). Firstly ive seen #217 and looking forward to API-ification. In the meantime, im using subprocess to call youtube-dl, but am curious on how my code can get the download progress. Im running it like so ``` p = subprocess.Popen([yt_path, "http://www.youtube.com/watch?v=%s" %(ytid), "-o", filename ], stdout=subprocess.PIPE) com = p.communicate() ``` Here after the first line, it executes youtube-dl, only when it finishes the download, the next line is executed with the shell output. Is there a way I can regularly poll the subprocess for the latest shell output so my application can know what the progress is? I understand this has more to do with subprocess than youtube-dl, but i figured some users may have already figured it out.
Author
Owner

@phihag commented on GitHub (Nov 20, 2011):

You can simply read from p.stdin asynchronously. We don't make any promises about the output you'll get (that's what #152 would do), but realistically, it won't change much.

@phihag commented on GitHub (Nov 20, 2011): You can simply read from `p.stdin` asynchronously. We don't make any promises about the output you'll get (that's what #152 would do), but realistically, it won't change much.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#151
No description provided.