Is there a way to play a video and make it follow YouTube autoplay videos?

Can this be done with youtube-dl and/or mpv?


It is possible to stream with youtube-dl and mpv.

My script does exactly what you want. It is very simple...

  1. checks if its a YT link or not,
  2. check the params given
    • -d for download
    • -nv for no video, so you can listen a music video.
  3. with wget get the source of the YT link for example
  4. with some grepping and cutting get the video IDs of all the following recommended videos
  5. play them one by one
  • not good. kills all other currently running instances of mpv. miffed >9000 – Digit Jan 18 '19 at 0:22
  • seems to work happy just comment out the kill line, then all other paused mpv instances dont need to die. #[[ $(pgrep "mpv") ]] && pkill "mpv" – Digit Feb 9 '19 at 9:58

I think your best bet with the least effort might be with the terminal program mps-youtube's related video functionality. Check it out here: https://github.com/mps-youtube/mps-youtube.

For example:

If you want to watch a bunch of Chris Cornell tribute videos and you have mps-youtube installed and launched, you can use the following command to set video playback to "true" (otherwise you will only get audio)

set show_video true

Then, find the video, or playlist your want to play:

For Videos:

.Chris Cornell Tribute

Then choose the video you want related videos for:

r 1

(where 1 is the video you want related videos for)

Then simply enter the range of the videos you would like played.


(will play all related videos, up to number 50.)

You may also need to set the default video player to mpv, as I think the program defaults to mPlayer. I realize this adds an entirely separate program into the mix, but it does utilize the tech's your asking about, while keeping you in the terminal.

  • Do you know that this will work, or are you just guessing? Can you describe how to do what the OP wants to do? Please do not respond in comments; edit your answer to make it clearer and more complete. – G-Man Says 'Reinstate Monica' May 17 '17 at 21:24

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.