-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can not combine --playlist-reverse and --playlist-start? #6845
Comments
It works that way because it first applies |
thanks for the fast feedback! I guess swapping the order would be how most people would expect the combination of these two options to work... at least I did :) a solution would be great because the --playlist-start option (in not-reversed downloads) isn't that suitable on very active channels, index will change as new videos get added all the time leading to wrong starting points which need to be handled manually then. thanks in advance! |
Had same issue. Kinda workaround that works for me is to use "--playlist-end 100" option to download first 100 videos in reverse order. I would also think that --playlist-start and --playlist-end should be applied to reversed list though. |
Please change the order of enumeration. I just wanted to play the last 20 videos in a 1000+ playlist (the entire channel) and there doesn't seem to be a way to do it. For me --playlist-reverse (for youtube sources) exists to download things in chronological order. |
One more request for this. Also, this and #514 are duplicates. |
For command: --playlist-start 2 --playlist-end 3 --playlist-reverse -o "%(playlist_index)s - %(title)s.%(ext)s"
I think -playlist-reverse should be applied to the whole list, first. Playlist will become like this:
--playlist-start 2 --playlist-end 3 should be applied to it. So video d and c will be downloaded.
|
For command: --playlist-start 2 --playlist-reverse -o "%(playlist_index)s - %(title)s.%(ext)s"
I think -playlist-reverse should be applied to the whole list, first. Playlist will become like this:
--playlist-start 2 should be applied to it. So video d, c, b, a will be downloaded.
|
For command: --playlist-end 3 --playlist-reverse -o "%(playlist_index)s - %(title)s.%(ext)s"
I think -playlist-reverse should be applied to the whole list, first. Playlist will become like this:
--playlist-end 3 should be applied to it. So video e, d and c will be downloaded.
|
This report is sort of old, but I didn't want to start a new one because it is essentially the same issue. Here is some output to illustrate: Without
With
Notice it starts at episode 907 (the latest as of the time of this writing), instead of 757 (the first on youtube and in the playlist). |
@mihawk90 I had also struggled with this issue for a long time. Merging #17347 would solve it. However, I'm afraid the maintainers will never merge it since it's buried under thousands of newer pull requests (it's currently at page 13 of the pull requests list). Up until now I've been using the fork directly. |
At this point, it seems likely that the youtube-dl folk either 1) don't view this as an issue, or 2) don't want to provide reasons on why the code I submitted to fix this issue is unacceptable. My original PR of #17347 corrected the issue present after some iteration to resolve legitimate issues, and then waited over a year with no review. The second PR of #24487 has now been closed to discussion after being opened just shy of a month ago with no review / comments by the developers. |
A quick solution, if someone came across the above^ (and doesn't want to use to build from the fork by @ALurker) The following python3 script will generate commands for you, create a .sh file and execute them, you can remove the starting vids, which have already been downloaded. import os
playlist = "https://www.youtube.com/user/..."
command = f"youtube-dl -j --flat-playlist --playlist-reverse {playlist} | jq -r '.id' | sed 's_^_https://youtu.be/_'"
output = os.popen(command).read()
print(output)
ytUrls = []
for count, urls in zip(range(1, 1000), output.strip().split("\n")):
count = str(count).zfill(3)
cmd = f'youtube-dl -f mp4 -i -v -R 3 --fragment-retries 3 -c -o "{count} - %(title)s.%(ext)s" {urls} --external-downloader "aria2c" --external-downloader-args "-j 10 -s 10 -x 16 --file-allocation=none -c"'
print(cmd) Gist: https://gist.github.com/Anon-Exploiter/ca3ab8f7a7edee8227622c7a6a97e396 |
Another solution that only uses bash. I also felt frustrated with this, so I wrote a straightforward workaround. Maybe others will find it useful.
|
Always double-quote var refs unless it's specifically necessary to allow splitting. The YT URL's usually have a question mark among others, which could break the script. Would recommend checking for the emptiness of ytdl_recent() {
for _link in "${@}"; do
# shellcheck disable=SC2155
_total=$(youtube-dl --flat-playlist "${_link}" | tail -n2 | head -n1 | cut -d ' ' -f4)
[ ! "${_total}" ] && {
echo 'Failed to find the total number of videos for the link "'"${_link}"'". Skipping.'
continue
}
youtube-dl "${_link}" --playlist-start $((_total - 2)) #subtract N to download the final N+1 videos
done
} Now it also works with Dash/POSIX sh, and can handle any number of links. |
Hello everyone
i was playing with the --playlist-reverse and the --playlist start NUMBER options to try to download in chronological order and resume where i stopped (like the next day continue at the 26th video) and found that these two options do not work together.
im not sure if this is a bug or if they are not supposed to be combined at all (maybe the help should say so then): in this case i would like to make a feature request for it!
some examples to show what i mean:
1: playlist-start 1 - no reverse
C:\youtubedl>youtube-dl.exe -e --max-downloads 3 --playlist-start 1 https://www.youtube.com/user/youtube
Introducing YouTube Gaming
ProudToLove - Celebrating Marriage Equality and LGBT Pride Month
The A-Z of YouTube: Celebrating 10 Years
2: playlist-start 3 - no reverse (works as expected #1 video now = #3 of the previous command)
C:\youtubedl>youtube-dl.exe -e --max-downloads 3 --playlist-start 3 https://www.youtube.com/user/youtube
The A-Z of YouTube: Celebrating 10 Years
DearMe - What Advice Would You Give Your Younger Self?
Highlights From the YouTube Interview with President Obama
3: playlist-start 1 + reverse
C:\youtubedl>youtube-dl.exe -e --max-downloads 3 --playlist-reverse --playlist-start 1 https://www.youtube.com/user/youtube
YouTube on the tube!
Hammer Time!
A Message From Chad and Steve
and finally
4: playlist-start 3 + reverse (BUG HERE: this gives the same result as command #3 above)
C:\youtubedl>youtube-dl.exe -e --max-downloads 3 --playlist-reverse --playlist-start 3 https://www.youtube.com/user/youtube
YouTube on the tube!
Hammer Time!
A Message From Chad and Steve
thanks in advance for feedback!
The text was updated successfully, but these errors were encountered: