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.
Fetching youtube history doesn't respect playlist-end parameter #16238
Comments
|
I dug into the code a little, and I found a potential solution, though I don't know how much it would break things. In the _real_extract() function in youtube.py, after ids.extend(new_ids), you could check the length of 'ids' and break out of the loop if that length is greater than what was specified for the --playlist-end parameter, because only the items found before this will be returned anyway. Does this seem like a reasonable solution? I'd make a pull request, but I don't know how to get access to the --playlist-end parameter inside the _real_extract function. |
|
No, it's not. Correct solution is to use generator based entries or PagedList playlist. |
|
Searching for "PagedList" (I have no idea what that is), I found this bug from two years ago. Seems like they want the same thing I want: #10184 A change like this is a bit over my head, without help. In any case, thank you and the other collaborators for this awesome project! |
Please follow the guide below
xinto all the boxes [ ] relevant to your issue (like this:[x])Make sure you are using the latest version: run
youtube-dl --versionand ensure your version is 2018.04.16. 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
If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:
Add the
-vflag to your command line you run youtube-dl with (youtube-dl -v <your command line>), copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):Description of your issue, suggested solution and other information
I'm trying to fetch my youtube watch history using youtube-dl as it's no longer provided by the youtube api v3. This works great using the following command:
or
As expected, this returns the latest 10 videos watched, in json format.
Unfortunately, it seems to have to download every page of my history (as you can see by removing the -j flag: 72 pages total, 8427 videos) before returning the first 10 videos, which are all on the first page.
It should have only had to request 1 page, but it keeps requesting pages until it has them all. As it takes a couple seconds to fetch each page, shouldn't it stop once it's found 10 videos, as I've specified in the --playlist-end parameter?
I understand why it would need to look at all the pages until it gets to the video I specified in --playlist-start, but once it gets to the --playlist-end'th video, I expect it to stop fetching pages and return what it's found now that it has all the information I requested (it's seen everything between --playlist-start and --playlist-end).