The normal output for youtube-dl is the following

[download] Downloading video #3 of 33
[youtube] WbWb0u8bJrU: Downloading webpage
[youtube] WbWb0u8bJrU: Downloading video info webpage
[youtube] WbWb0u8bJrU: Extracting video information
[download] Resuming download at byte 107919109
[download] Destination: Lec 6.mp4
[download]  86.2% of 137.18MiB at 48.80KiB/s ETA 06:37

I need to show the first and last monitor the downloading I use the command

 youtube-dl -cit -f 18 URL | grep -e ETA -e "Downloading video #"

It's not working only the first line is working while the last line is not, and I see the download is running as the file size grows

  • did you want to see only the last line from the running output? I mean [download] 11.2% of 13.33MiB at 8.40KiB/s ETA 24:03 line only. – Avinash Raj May 27 '14 at 14:16

I am assuming that you want to get just the last line.

To do this, simply add the --newline flag to youtube-dl.

youtube-dl --newline -cit -f 18 URL | grep -e ETA -e "Downloading video #"

This causes the progress to be output to a new line each time, rather than continually erasing and deleting parts of the same line. This is required for your grep command to work.

| improve this answer | |
  • many thanks for the answer it did what i need ,but is there a way to show only one line of the output – Fat Mind May 28 '14 at 4:50
  • That would be a bit trickier. You would have to delete the previous line before printing the current line. I know how to do it in Python, but it would be a much longer script. You could probably do it in bash by piping the output of the above command to a command which prints a delete character. However, I've had a quick go at this and I can't quite get it right. – daviewales May 28 '14 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.