Welcome to the most active Linux Forum on the web.
Go Back > Blogs > linux-related notes
User Name


Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Rate this Entry

Generate random mixes of youtube playlists on some command line, to watch it on some browser

Posted 02-16-2023 at 10:10 AM by the dsc
Updated 02-16-2023 at 10:51 AM by the dsc

I eventually became somewhat youtube-dependent for media consumption, but I don't quite like the natural flow of youtube's algorithms' "play next" suggestions, which are probably even minimally bearable when I'm logged in.

So it can be interesting to have a shuffle of a series of chosen playlists to be played when we're doing whatever. The arguably best-ish way for doing it is to save YT playlists (the list of URLs, not the video files themselves) on disk, then do some bash/sed trickery to mix and shuffle them according to whatever quantities of each you want, and then play on something like MPV.

But sites will be always fixing what isn't broken and breaking things in the process, so right now, hopefuly momentarily, MPV doesn't play youtube videos. (Fix: )

BUT you can still have this custom-playlist-shuffle going on, on youtube's own web interface.

You do nearly the same bash/sed/perl/awk shuffling trickery you'd do for MPV, but you grab only the video IDs and put them like so:


And launch it in whatever is one's favorite browser for this kind of thing. It will have generated a playlist like those you'd make clicking the custom watch next button on several thumbnails.

I don't know what's the maximum, possibly even depends on the browser itself.

I wonder if doing it launching a browser that's logged on one's own account will sort of train the algorithm to be significantly better in generating play-next patterns, eventually. But I guess it's always more based on other videos from the same channel or huge-audience channels that are watched by most people who also watch channel of the current video, something along those lines, rather than really having significant variables for the individual user's own preferences/history. I even recall having read some headline that someone did a test (which I assume/hope was well designed enough) and found out that liking and/or disliking videos doesn't really affect suggestions, surprisingly enough.

If a given player is being able to handle youtube URLs, that's often preferable, as one can also mix other sites on the playlist, whatever youtube-dl or some analog plugin supports at the moment, besides media on one's own storage, neither of which are possible on this simplified version suggested here, that obviously deals only with youtube. In the other hand, youtube itself probably prefers this method, as it counts as visits and whatnot. Even the channels themselves benefit more, regarding view counts and whatnot, so maybe in the end this more "native" method is even preferable, if other sources are not necessary.
Posted in Uncategorized
Views 165 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 09:09 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration