ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.01k stars 10.01k forks source link

Honor sort parameter in youtube channel video listing URLs #20316

Open anohren opened 5 years ago

anohren commented 5 years ago

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2019.03.09. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

Before submitting an issue make sure you have:

What is the purpose of your issue?


The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


Description of your issue, suggested solution and other information

When listing a Youtube channel's entire video catalog using the "Videos" tab, there's the option to sort them by date in descending (newest first) or ascending (oldest first) order. This is reflected in the URL as the sort= parameter, e.g. sort=da which I assume means "date ascending". When using a URL with this parameter in youtube-dl, the parameter seems to be ignored.

Unlike #2405 this request doesn't ask for an option to sort the results explicitly, just to honor the parameter when present in the URL, whether optionally or by default.

The benefit for users would be that if they're using youtube-dl indirectly -- e.g. built into a media player -- and are unable to directly pass options to it, they can still control the ordering of the result by way of the URL and web UI. The results reflect the URL more accurately.

How I tested it:

Expected behavior

The oldest video is listed first.

Actual behavior

The most recent video is listed first.

Example URL

ElectroBOOM sorted by date in ascending order:

https://www.youtube.com/user/msadaghd/videos?sort=da&view=0&flow=grid

ealgase commented 5 years ago

The current way the channel extractor works is it finds the channel's playlist (ID is just the channel ID with UC replaced with UU). This would require significant modification to the channel extractor.

anohren commented 5 years ago

Thanks for the insights and clarification of potential obstacles. I'm afraid I'm not familiar with channel IDs or where they appear so I don't know how to use that to test anything out at the moment.

I was hoping that there would be some way to enable the -- not too uncommon, in my opinion -- use case of listing all channel videos chronologically without having to conditionally set an option like --playlist-reverse depending on whether the URL points to a youtube channel or not. Sounds like it's not worth the effort though.

ealgase commented 5 years ago

Your use case is definitely useful, I was just mentioning the reason why it's not easy to implement.