Skip to content

[Youtube] Request for update of --datebefore --dateafter behaviour when downloading videos chronologically via channels. #11084

@pxssy

Description

@pxssy

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

  • I understand that I will be blocked if I intentionally remove or skip any mandatory* field

Checklist

Region

Singapore

Example URLs

https://www.youtube.com/@NileRed

Provide a description that is worded well enough to be understood

When a youtube channel input like https://www.youtube.com/@NileRed is given to yt-dlp, it parses ALL /video and /shorts, then downloads them sequentially by chronological order, latest upload first, as its what is given by the API. Its not possible to sort in any other way.

In this case, If an option like --dateafter or --datebefore is used, many unnecessary requests are sent to youtube for videos that clearly will not match a filter.

Example

yt-dlp https://www.youtube.com/@NileRed --dateafter 21001231 will match 0 videos, since the earliest video is in 2024. However it will check through EVERY video, even the ones before 2024, which is unnecessary and slow.

Similarly, yt-dlp https://www.youtube.com/@NileRed --datebefore 00010101 will also match 0 videos, but it will check every video until the very first one.

Until youtube changes this, I believe this additional checks are not necessary at all.

Therefore I suggest 2 changes.

  1. --datebefore runs the downloading backwards, starting from the oldest video in the channel.

EDIT: an existing workaround is -I "::-1"

  1. a switch like --date-skip 5, that skips process after it has checked 5 videos and they do not match the date requirements.

Expected behaviour should then be

yt-dlp https://www.youtube.com/@NileRed --dateafter 20240101 --date-skip 3

Downloads videos after 20240101
skip
skip
skip
Download shorts after 20240101
skip
skip
skip

exit

Provide verbose output that clearly demonstrates the problem

  • Run your yt-dlp command with -vU flag added (yt-dlp -vU <your command line>)
  • If using API, add 'verbose': True to YoutubeDL params instead
  • Copy the WHOLE output (starting with [debug] Command-line config) and insert it below

Complete Verbose Output

yt-dlp --datebefore 00010101 https://www.youtube.com/@NileRed --verbose
[debug] Command-line config: ['--datebefore', '00010101', 'https://www.youtube.com/@NileRed', '--verbose']
[debug] User config "config": ['']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2024.09.24.232842 from yt-dlp/yt-dlp-nightly-builds [fa2be9a7c] (pip)
[debug] Python 3.12.6 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 3.0.15 3 Sep 2024)
[debug] exe versions: ffmpeg N-115203-gbaf8651d56-20240513 (setts), ffprobe N-115203-gbaf8651d56-20240513, phantomjs 2.1.1
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.08.30, mutagen-1.47.0, requests-2.32.3, sqlite3-3.45.3, urllib3-2.2.3, websockets-13.1
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1835 extractors
[youtube:tab] Extracting URL: https://www.youtube.com/@NileRed
[youtube:tab] @NileRed: Downloading webpage
[debug] [youtube:tab] Selected tab: 'videos' (videos), Requested tab: ''
[youtube:tab] Downloading all uploads of the channel. To download only the videos in a specific tab, pass the tab's URL
[youtube:tab] @NileRed/shorts: Downloading webpage
[debug] [youtube:tab] Selected tab: 'shorts' (shorts), Requested tab: 'shorts'
[youtube:tab] Downloading as multiple playlists, separated by tabs. To download as a single playlist instead, pass https://www.youtube.com/playlist?list=UUFhXFikryT4aFcLkLw2LBLA
[download] Downloading playlist: NileRed
[info] Playlist metadata is already present
[info] Playlist description is already present
[info] Playlist thumbnail is already present
[youtube:tab] Playlist NileRed: Downloading 2 items of 2
[download] Downloading item 1 of 2
[download] Downloading playlist: NileRed - Videos
[youtube:tab] UCFhXFikryT4aFcLkLw2LBLA page 1: Downloading API JSON
[youtube:tab] UCFhXFikryT4aFcLkLw2LBLA page 2: Downloading API JSON
[youtube:tab] UCFhXFikryT4aFcLkLw2LBLA page 3: Downloading API JSON
[youtube:tab] UCFhXFikryT4aFcLkLw2LBLA page 4: Downloading API JSON
[youtube:tab] UCFhXFikryT4aFcLkLw2LBLA page 5: Downloading API JSON
[youtube:tab] UCFhXFikryT4aFcLkLw2LBLA page 6: Downloading API JSON
[youtube:tab] UCFhXFikryT4aFcLkLw2LBLA page 7: Downloading API JSON
[youtube:tab] UCFhXFikryT4aFcLkLw2LBLA page 8: Downloading API JSON
[info] Playlist metadata is already present
[info] Playlist description is already present
[info] Playlist thumbnail is already present
[youtube:tab] Playlist NileRed - Videos: Downloading 251 items of 251
[download] Downloading item 1 of 251
[youtube] Extracting URL: https://www.youtube.com/watch?v=jLX1-tNnvEo
[youtube] jLX1-tNnvEo: Downloading webpage
[youtube] jLX1-tNnvEo: Downloading ios player API JSON
[youtube] jLX1-tNnvEo: Downloading web creator player API JSON
[debug] Loading youtube-nsig.c9dd45ed from cache
[debug] [youtube] Decrypted nsig 2HqjJ75qkzDAoMUdpF => 98pO5hZ1yv7PTw
[debug] Loading youtube-nsig.c9dd45ed from cache
[debug] [youtube] Decrypted nsig 5NEltXam7GOypjuW9U => oUvC7giTxr91DA
[youtube] jLX1-tNnvEo: Downloading m3u8 information
[info] jLX1-tNnvEo: Downloading subtitles: en
[debug] Sort order given by user: res, fps, quality, size, br
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, res, fps, quality, size, br, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, asr, vext, aext, hasaud, id
[download] 2024-08-31 upload date is not in range 0001-01-01 to 0001-01-01
[download] Downloading item 2 of 251
[youtube] Extracting URL: https://www.youtube.com/watch?v=zMaTrgUKC1w
[youtube] zMaTrgUKC1w: Downloading webpage
[youtube] zMaTrgUKC1w: Downloading ios player API JSON
[youtube] zMaTrgUKC1w: Downloading web creator player API JSON
[debug] Loading youtube-nsig.c9dd45ed from cache
[debug] [youtube] Decrypted nsig -cJPY_nl4hSZIU_t8D => 7TWGBCwrqo6oAA
[debug] Loading youtube-nsig.c9dd45ed from cache
[debug] [youtube] Decrypted nsig 9ZYUkzMszB2kUfdUpo => U8HeG4ENlGQDsQ
[youtube] zMaTrgUKC1w: Downloading m3u8 information
[info] zMaTrgUKC1w: Downloading subtitles: en
[debug] Sort order given by user: res, fps, quality, size, br
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, res, fps, quality, size, br, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, asr, vext, aext, hasaud, id
[download] 2024-03-16 upload date is not in range 0001-01-01 to 0001-01-01

etcetc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions