Skip to content

[ARDMediathek] unhandled error in datetime.datetime.fromtimestamp() #6706

Closed

Description

@chrizilla

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

possible restriced to Germany or German-speaking parts of the world

Provide a description that is worded well enough to be understood

I have discovered a problem with this URL: https://www.ardmediathek.de/video/Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ
The video is playable.

short summary:

If I use --ignore-config everything is fine (so I don't think this issue is related to #2630 ). But with my config file enabled, yt-dlp aborts with errors. I am doubtful however that my config file is the culprit because it works fine for every other site. So maybe something else is going on? I was unable to pin down the problem.

detailed report:

With --ignore-config yt-dlp is able to print the available formats:

yt-dlp -v --ignore-config -F https://www.ardmediathek.de/video/Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ
[debug] Command-line config: ['-v', '--ignore-config', '-F', 'https://www.ardmediathek.de/video/Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.03.04 [392389b7d] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg N-105208-gb24f0c82b3-20220108 (setts), ffprobe N-105208-gb24f0c82b3-20220108
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1786 extractors
[debug] Using fake IP 53.126.204.220 (DE) as X-Forwarded-For
[ARDBetaMediathek] Extracting URL: https://www.ardmediathek.de/video/Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ
[ARDBetaMediathek] Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ: Downloading JSON metadata
[ARDBetaMediathek] 10204341: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[info] Available formats for 10204341:
ID       EXT RESOLUTION FPS │   FILESIZE   TBR PROTO │ VCODEC        VBR ACODEC    ABR
──────────────────────────────────────────────────────────────────────────────────────
a0-mp4-0 mp4 unknown        │                  https │ unknown           unknown
a0-mp4-1 mp4 unknown        │                  https │ unknown           unknown
a0-mp4-2 mp4 unknown        │                  https │ unknown           unknown
a0-mp4-3 mp4 unknown        │                  https │ unknown           unknown
hls-262  mp4 480x270     25 │ ~  8.57MiB  263k m3u8  │ avc1.42c015  263k mp4a.40.2  0k
hls-947  mp4 640x360     25 │ ~ 30.87MiB  947k m3u8  │ avc1.4d401e  947k mp4a.40.2  0k
hls-1665 mp4 960x540     25 │ ~ 54.28MiB 1665k m3u8  │ avc1.4d401f 1665k mp4a.40.2  0k
hls-3726 mp4 1280x720    25 │ ~121.46MiB 3727k m3u8  │ avc1.640020 3727k mp4a.40.2  0k

But with my config file enabled, it aborts with an error:

[debug] Command-line config: ['https://www.ardmediathek.de/video/Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ', '-F']
[debug] Portable config "c:\hp\-\!portableapps\yt-dlp\yt-dlp.conf": ['--verbose', '--format-sort', 'hasvid,ie_pref,quality,res,hdr,codec,size,br,asr,ext,fps,hasaud,lang,source,proto,id', '-f', 'bestvideo*+bestaudio/best', '--paths', 'c:\\hp\\-\\#YT', '-o', '.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'thumbnail:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\thumbs\\thumb.%(ext)s', '-o', 'subtitle:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\subs\\%(alt_title,title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'infojson:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(alt_title,title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'link:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'description:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'annotation:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'pl_infojson:.\\%(playlist|)s\\playlist.%(ext)s', '-o', 'pl_thumbnail:.\\%(playlist|)s\\folder.%(ext)s', '-o', 'pl_description:.\\%(playlist|)s\\playlist description.%(ext)s', '--output-na-placeholder', '~~~', '--write-info-json', '--write-description', '--write-annotations', '--no-overwrites', '--no-post-overwrites', '--merge-output-format', 'mkv', '--remux-video', 'mkv', '--write-subs', '--write-auto-subs', '--all-subs', '--sub-langs', 'all', '--sub-format', 'all/ttml/vtt/best', '--write-thumbnail', '--write-all-thumbnails', '--add-metadata', '--embed-chapters', '--add-chapters', '--write-link', '--write-url-link', '--write-desktop-link', '--no-check-certificate', '--retries', 'infinite', '--geo-bypass', '--geo-bypass-country', 'AT', '--no-clean-infojson', '--write-comments', '--audio-multistreams', '--no-playlist']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.03.04 [392389b7d] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg N-105208-gb24f0c82b3-20220108 (setts), ffprobe N-105208-gb24f0c82b3-20220108
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1786 extractors
[debug] Using fake IP 77.119.217.5 (AT) as X-Forwarded-For
[ARDBetaMediathek] Extracting URL: https://www.ardmediathek.de/video/Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ
[ARDBetaMediathek] Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ: Downloading JSON metadata
[ARDBetaMediathek] 10204341: Downloading m3u8 information
[debug] Sort order given by user: hasvid, ie_pref, quality, res, hdr, codec, size, br, asr, ext, fps, hasaud, lang, source, proto, id
[debug] Formats sorted by: hasvid, ie_pref, quality, res, hdr, vcodec, acodec, filesize, fs_approx, tbr, vbr, abr, asr, vext, aext, fps, hasaud, lang, source, proto, id, channels
[info] Available formats for 10204341:
ID       EXT RESOLUTION FPS │   FILESIZE   TBR PROTO │ VCODEC        VBR ACODEC    ABR
──────────────────────────────────────────────────────────────────────────────────────
a0-mp4-0 mp4 unknown        │                  https │ unknown           unknown
a0-mp4-1 mp4 unknown        │                  https │ unknown           unknown
a0-mp4-2 mp4 unknown        │                  https │ unknown           unknown
a0-mp4-3 mp4 unknown        │                  https │ unknown           unknown
hls-262  mp4 480x270     25 │ ~  8.57MiB  263k m3u8  │ avc1.42c015  263k mp4a.40.2  0k
hls-947  mp4 640x360     25 │ ~ 30.87MiB  947k m3u8  │ avc1.4d401e  947k mp4a.40.2  0k
hls-1665 mp4 960x540     25 │ ~ 54.28MiB 1665k m3u8  │ avc1.4d401f 1665k mp4a.40.2  0k
hls-3726 mp4 1280x720    25 │ ~121.46MiB 3727k m3u8  │ avc1.640020 3727k mp4a.40.2  0k
ERROR: [Errno 22] Invalid argument
Traceback (most recent call last):
  File "yt_dlp\YoutubeDL.py", line 1518, in wrapper
  File "yt_dlp\YoutubeDL.py", line 1615, in __extract_info
  File "yt_dlp\YoutubeDL.py", line 1674, in process_ie_result
  File "yt_dlp\YoutubeDL.py", line 2708, in process_video_result
  File "yt_dlp\YoutubeDL.py", line 1354, in prepare_filename
  File "yt_dlp\YoutubeDL.py", line 1325, in _prepare_filename
  File "yt_dlp\YoutubeDL.py", line 1316, in evaluate_outtmpl
  File "yt_dlp\YoutubeDL.py", line 1313, in prepare_outtmpl
  File "yt_dlp\YoutubeDL.py", line 1250, in create_key
  File "yt_dlp\YoutubeDL.py", line 1217, in get_value
  File "yt_dlp\utils.py", line 2647, in strftime_or_none
OSError: [Errno 22] Invalid argument

As far as downloading is concerned, the same thing happens. With --ignore-config, the download works just fine:

yt-dlp -v --ignore-config https://www.ardmediathek.de/video/Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ
[debug] Command-line config: ['-v', '--ignore-config', 'https://www.ardmediathek.de/video/Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.03.04 [392389b7d] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg N-105208-gb24f0c82b3-20220108 (setts), ffprobe N-105208-gb24f0c82b3-20220108
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1786 extractors
[debug] Using fake IP 53.105.40.81 (DE) as X-Forwarded-For
[ARDBetaMediathek] Extracting URL: https://www.ardmediathek.de/video/Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ
[ARDBetaMediathek] Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ: Downloading JSON metadata
[ARDBetaMediathek] 10204341: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 10204341: Downloading 1 format(s): hls-3726
[debug] Invoking hlsnative downloader on "https://brvod-rwrtr.akamaized.net/i/,/MUJIuUOVBwQIbtCCBLzGiLC1uwQoNA4p_2JS/_-iS/_2rg5-gH_U1S/c5837c63-6ad0-40a4-a28a-9c8ed4602d99_,C,X,A,E,.mp4.csmil/index-f2-v1-a1.m3u8"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 30
[download] Destination: Flugshow Fürstenfeldbruck 1960 mit F-104 Starfighter [10204341].mp4
[debug] File locking is not supported. Proceeding without locking
[download]   6.9% of ~  47.73MiB at  229.11KiB/s ETA 03:20 (frag 3/30)
ERROR: Interrupted by user

But, again, with my config file enabled, the download attempt results in this error:

yt-dlp https://www.ardmediathek.de/video/Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ
[debug] Command-line config: ['https://www.ardmediathek.de/video/Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ']
[debug] Portable config "c:\hp\-\!portableapps\yt-dlp\yt-dlp.conf": ['--verbose', '--format-sort', 'hasvid,ie_pref,quality,res,hdr,codec,size,br,asr,ext,fps,hasaud,lang,source,proto,id', '-f', 'bestvideo*+bestaudio/best', '--paths', 'c:\\hp\\-\\#YT', '-o', '.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'thumbnail:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\thumbs\\thumb.%(ext)s', '-o', 'subtitle:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\subs\\%(alt_title,title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'infojson:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(alt_title,title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'link:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'description:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'annotation:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'pl_infojson:.\\%(playlist|)s\\playlist.%(ext)s', '-o', 'pl_thumbnail:.\\%(playlist|)s\\folder.%(ext)s', '-o', 'pl_description:.\\%(playlist|)s\\playlist description.%(ext)s', '--output-na-placeholder', '~~~', '--write-info-json', '--write-description', '--write-annotations', '--no-overwrites', '--no-post-overwrites', '--merge-output-format', 'mkv', '--remux-video', 'mkv', '--write-subs', '--write-auto-subs', '--all-subs', '--sub-langs', 'all', '--sub-format', 'all/ttml/vtt/best', '--write-thumbnail', '--write-all-thumbnails', '--add-metadata', '--embed-chapters', '--add-chapters', '--write-link', '--write-url-link', '--write-desktop-link', '--no-check-certificate', '--retries', 'infinite', '--geo-bypass', '--geo-bypass-country', 'AT', '--no-clean-infojson', '--write-comments', '--audio-multistreams', '--no-playlist']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.03.04 [392389b7d] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg N-105208-gb24f0c82b3-20220108 (setts), ffprobe N-105208-gb24f0c82b3-20220108
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1786 extractors
[debug] Using fake IP 77.118.110.112 (AT) as X-Forwarded-For
[ARDBetaMediathek] Extracting URL: https://www.ardmediathek.de/video/Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ
[ARDBetaMediathek] Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ: Downloading JSON metadata
[ARDBetaMediathek] 10204341: Downloading m3u8 information
[debug] Sort order given by user: hasvid, ie_pref, quality, res, hdr, codec, size, br, asr, ext, fps, hasaud, lang, source, proto, id
[debug] Formats sorted by: hasvid, ie_pref, quality, res, hdr, vcodec, acodec, filesize, fs_approx, tbr, vbr, abr, asr, vext, aext, fps, hasaud, lang, source, proto, id, channels
[info] 10204341: Downloading 1 format(s): hls-3726
ERROR: [Errno 22] Invalid argument
Traceback (most recent call last):
  File "yt_dlp\YoutubeDL.py", line 1518, in wrapper
  File "yt_dlp\YoutubeDL.py", line 1615, in __extract_info
  File "yt_dlp\YoutubeDL.py", line 1674, in process_ie_result
  File "yt_dlp\YoutubeDL.py", line 2779, in process_video_result
  File "yt_dlp\YoutubeDL.py", line 3010, in process_info
  File "yt_dlp\YoutubeDL.py", line 1354, in prepare_filename
  File "yt_dlp\YoutubeDL.py", line 1325, in _prepare_filename
  File "yt_dlp\YoutubeDL.py", line 1316, in evaluate_outtmpl
  File "yt_dlp\YoutubeDL.py", line 1313, in prepare_outtmpl
  File "yt_dlp\YoutubeDL.py", line 1250, in create_key
  File "yt_dlp\YoutubeDL.py", line 1217, in get_value
  File "yt_dlp\utils.py", line 2647, in strftime_or_none
OSError: [Errno 22] Invalid argument

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

see above

Activity

  1. chrizilla commented on Apr 3, 2023

    @chrizilla
    Author

    If it helps identifying the problem, this issue was already present in yt-dlp version 2023.01.06.
    On 19 january 2023 I tried downloading the same URL with said yt-dlp version and got this error back then:

    yt-dlp "https://www.ardmediathek.de/video/Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ"
    [debug] Command-line config: ['https://www.ardmediathek.de/video/Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ']
    [debug] Portable config "c:\hp\-\!portableapps\yt-dlp\yt-dlp.conf": ['--verbose', '--format-sort', 'hasvid,ie_pref,quality,res,hdr,codec,size,br,asr,ext,fps,hasaud,lang,source,proto,id', '-f', 'bestvideo*+bestaudio/best', '--paths', 'c:\\hp\\-\\mov\\!yt', '-o', '.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'thumbnail:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\thumbs\\thumb.%(ext)s', '-o', 'subtitle:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\subs\\%(alt_title,title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'infojson:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(alt_title,title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'link:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'description:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'annotation:.\\%(playlist|)s\\%(playlist_index|)02d%(playlist_index& = |)s%(release_date>%Y-%m-%d,release_timestamp>%Y-%m-%d,upload_date>%Y-%m-%d,timestamp>%Y-%m-%d|#nodate#)s %(alt_title,title)s\\!nfo\\%(title)s [%(extractor)s.%(extractor_key)s.%(id)s] [%(format_id)s].%(ext)s', '-o', 'pl_infojson:.\\%(playlist|)s\\playlist.%(ext)s', '-o', 'pl_thumbnail:.\\%(playlist|)s\\folder.%(ext)s', '-o', 'pl_description:.\\%(playlist|)s\\playlist description.%(ext)s', '--output-na-placeholder', '~~~', '--write-info-json', '--write-description', '--write-annotations', '--no-overwrites', '--no-post-overwrites', '--merge-output-format', 'mkv', '--remux-video', 'mkv', '--write-subs', '--write-auto-subs', '--all-subs', '--sub-langs', 'all', '--sub-format', 'all/ttml/vtt/best', '--write-thumbnail', '--write-all-thumbnails', '--add-metadata', '--embed-chapters', '--add-chapters', '--write-link', '--write-url-link', '--write-desktop-link', '--no-check-certificate', '--retries', 'infinite', '--geo-bypass', '--geo-bypass-country', 'DE', '--no-clean-infojson', '--write-comments', '--audio-multistreams', '--no-playlist']
    [debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
    [debug] yt-dlp version 2023.01.06 [6becd25] (win_exe)
    [debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19043-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
    [debug] exe versions: ffmpeg N-105208-gb24f0c82b3-20220108 (setts), ffprobe N-105208-gb24f0c82b3-20220108
    [debug] Optional libraries: Cryptodome-3.16.0, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
    [debug] Proxy map: {}
    [debug] Loaded 1760 extractors
    [debug] Using fake IP 53.222.62.41 (DE) as X-Forwarded-For
    [ARDBetaMediathek] Extracting URL: https://www.ardmediathek.de/video/Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ
    [ARDBetaMediathek] Y3JpZDovL2JyLmRlL3ZpZGVvL2M1ODM3YzYzLTZhZDAtNDBhNC1hMjhhLTljOGVkNDYwMmQ5OQ: Downloading JSON metadata
    [ARDBetaMediathek] 10204341: Downloading m3u8 information
    [debug] Sort order given by user: hasvid, ie_pref, quality, res, hdr, codec, size, br, asr, ext, fps, hasaud, lang, source, proto, id
    [debug] Formats sorted by: hasvid, ie_pref, quality, res, hdr, vcodec, acodec, filesize, fs_approx, tbr, vbr, abr, asr, vext, aext, fps, hasaud, lang, source, proto, id, channels
    [info] 10204341: Downloading 1 format(s): hls-3726
    ERROR: [Errno 22] Invalid argument
    Traceback (most recent call last):
      File "yt_dlp\YoutubeDL.py", line 1502, in wrapper
      File "yt_dlp\YoutubeDL.py", line 1599, in __extract_info
      File "yt_dlp\YoutubeDL.py", line 1658, in process_ie_result
      File "yt_dlp\YoutubeDL.py", line 2772, in process_video_result
      File "yt_dlp\YoutubeDL.py", line 2999, in process_info
      File "yt_dlp\YoutubeDL.py", line 1351, in prepare_filename
      File "yt_dlp\YoutubeDL.py", line 1322, in _prepare_filename
      File "yt_dlp\YoutubeDL.py", line 1313, in evaluate_outtmpl
      File "yt_dlp\YoutubeDL.py", line 1310, in prepare_outtmpl
      File "yt_dlp\YoutubeDL.py", line 1247, in create_key
      File "yt_dlp\YoutubeDL.py", line 1214, in get_value
      File "yt_dlp\utils.py", line 2627, in strftime_or_none
    OSError: [Errno 22] Invalid argument
    
  2. dirkf commented on Apr 4, 2023

    @dirkf
    Contributor

    The code is calling datetime.datetime.fromtimestamp(), which

    ... may raise OverflowError, if the timestamp is out of the range of values supported by the platform C localtime() or gmtime() functions, and OSError on localtime() or gmtime() failure. It’s common for this to be restricted to years in 1970 through 2038. ...

    This is done inside a try block that handles neither OverflowError nor OSError.

    Apparently one of the date-time metadata fields being extracted, and used in the gigantic filename template in the config file, is an invalid number according to the above. In #5185 this happened as a result of a Python for Windows library bug. The suggested work-around applied to fix #5185 isn't effective here.

  3. chrizilla commented on Apr 4, 2023

    @chrizilla
    Author

    Hats off! This is some good detective work, dirkf.

  4. dirkf commented on Apr 4, 2023

    @dirkf
    Contributor

    The problem code line is shown in the log (20 lines up in the earlier log) and the code has comments referring to #5185, etc. So little psychic debugging was needed.

  5. added
    bugBug that is not site-specific
    and removed
    triageUntriaged issue
    on Apr 4, 2023
  6. self-assigned this
    on Apr 4, 2023
  7. pukkandan commented on Apr 4, 2023

    @pukkandan
    Member

    I will fix the core issue. But there is also the problem that the extractor is returning wrong timestamp which someone will need to look into.

  8. changed the title [-][ARDMediathek] extractor does not like my config file[/-] [+][ARDMediathek] unhandled error in datetime.datetime.fromtimestamp()[/+] on Apr 4, 2023
  9. dirkf commented on Apr 5, 2023

    @dirkf
    Contributor

    The ARDBetaMediathek extractor only returns timestamp and uses unified_timestamp() to extract it. So the problem is just that whatever value is being returned triggers the exception. Guess what? The text date is 1960-07-11T23:00:00Z and the resulting timestamp is -298947600.

    Based on the wording of POSIX.1-2017 4.16 (Seconds Since the Epoch)

    A value that approximates the number of seconds that have elapsed since the Epoch. A Coordinated Universal Time name (specified in terms of seconds (tm_sec), minutes (tm_min), hours (tm_hour), days since January 1 of the year (tm_yday), and calendar year minus 1900 (tm_year)) is related to a time represented as seconds since the Epoch, according to the expression below.

    If the year is <1970 or the value is negative, the relationship is undefined. If the year is ≥1970 and the value is non-negative, the value is related to a Coordinated Universal Time ...

    time_t-based date-time library functions can't be used reliably if the time_t might be negative. That seems to be how Microsoft interpreted time_t functionality for localtime_s()

    Error conditions
    tmDestsourceTimeReturn valueValue in tmDestInvokes invalid parameter handler
    ...
    Not NULL (points to valid memory)less than 0 or greater than _MAX__TIME64_TEINVALAll fields set to -1No

    The UTC work-around fixes a particular case where the code looks at Epoch - 1d to implement PEP495.

    Maybe it's possible to avoid the code path that calls the CRT functions using a timedelta?

    -            datetime_object = datetime.datetime.fromtimestamp(timestamp, datetime.timezone.utc)
    +            if timestamp > 86400:  # 1 day
    +                datetime_object = datetime.datetime.fromtimestamp(timestamp)
    +            else:
    +                # work-around localtime_s() failing on negative or <= 86400 time_t?
    +                datetime_object = datetime.datetime.fromtimestamp(0, datetime.timezone.utc)
    +                datetime_object = datetime_object + datetime.timedelta(seconds=timestamp)
  10. pukkandan commented on Apr 5, 2023

    @pukkandan
  11. dirkf commented on Apr 5, 2023

    @dirkf
    Contributor

    Even if the date-time when the "video was uploaded" should arguably always be positive, there is also release_timestamp. What value should that have for, say, Birth of a Nation (1915)?

    Ofc we could just say that all date-time values as timestamps in metadata are at least 0, but that would be a behaviour change for any users on platforms that can handle negative time_t. Also, JSON may be generated on such a platform and consumed on a Windows-like platform.

    There's a reason why people always say that date-time processing is a hard problem.

    This CPython PR was said to have fixed the Epoch - 1d issue for Py >= 3.6 more than 4 years ago, although #5185 had 3.8.10. And yt-dl has 3.4.4 for old Windows (though it doesn't have this problem function ATM).

    Reviewing the CPython code suggests that my work-around above might be worth trying on a Windows system, as the procedure for adding a timedelta to a datetime makes the latter into a second timedelta, adds those (no CRT), and returns the result of combining the date with day ordinal timedelta.days with the time offset part of the timedelta.

    Finally, I suppose (OSError, OverflowError), if not avoided, should cause default to be returned. Should a WARNING be made?

  12. chrizilla commented on Apr 6, 2023

    @chrizilla
    Author
  13. pukkandan commented on Apr 6, 2023

    @pukkandan
    Member

    No. Why do you say that? The video is from 1960. 12 July 1960 is the date it passed on TV according to the site.

    because timestamp is supposed to be the time when video was uploaded to the site. This should probably be release_timestamp?

    Anyway, it's not important anymore. dirkf is correct - it's better to patch it than disable it.

  14. chrizilla commented on Apr 6, 2023

    @chrizilla
    Author
  15. dirkf commented on Apr 6, 2023

    @dirkf
  16. chrizilla commented on Apr 6, 2023

    @chrizilla
    Author
  17. pukkandan commented on Apr 7, 2023

    @pukkandan
  18. added a commit that references this issue on Jan 28, 2024
    a35af43
  19. added a commit that references this issue on Apr 21, 2024
    d4c1b45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugBug that is not site-specific

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions