Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Fix playlist range optimizations for --playlist-items #14740
Comments
|
This is already implemented for YouTube. Apart from page is 30 videos not 100. |
|
No it isn't.
Clearly there are 28 pages downloaded for a user with 2844 videos uploaded. |
Make sure you are using the latest version: run
youtube-dl --versionand ensure your version is 2017.11.06. 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?
Some logic could be implemented to help prevent downloading massive playlists if certain criteria are met. For example, one channel that I archive has uploaded 2000+ videos, so each time I want to download the newest I have to page through 20 pages of the uploads playlist even though I just want the most recent one.
Looking at how the next page is navigated to, it looks like you wouldn't be able to skip any leading pages, but you can certainly avoid downloading extras after.
The easiest solution would be to use the fact that each page has at most 100 videos on it, so you could calculate the very last video index using what is known from the playlist index specifiers (start, end, item count), and only download up to the last page required, i.e.:
--playlist-items 1would only download the first page of the playlist.--playlist-items 99would also only download the first page of the playlist.--playlist-start 20 --playlist-items 170would download the first two pages.--playlist-start 20 --playlist-items 181would download the first three pages.--playlist-start 101 --playlist-end 345would download the first four pages.