Using subprocess to capture a progress line

Chris Angelico rosuav at gmail.com
Tue Nov 10 18:28:26 EST 2015


On Wed, Nov 11, 2015 at 9:47 AM, Tim Johnson <tim at akwebsoft.com> wrote:
> I've written a command-line "wrapper" for youtube-dl, executing
> youtube-dl as a subprocess.
>
> ------------------------------------------------------------------
> youtube-dl reports download progress on one line. I.E. the line is
> overwritten numerous times with no carriage return until the
> downloading is finished.
> ------------------------------------------------------------------
>

Sounds to me like a possible buffering problem. But since youtube-dl
is implemented in Python, you might find it easier to "pip install
youtube_dl" and work with the methods directly:

>>> import youtube_dl
>>> youtube_dl.YoutubeDL().download(["m39ydsOPSww"])

Should be possible to manipulate around the outside of that.

ChrisA



More information about the Python-list mailing list