Repository navigation
[ARDMediathek] unhandled error in datetime.datetime.fromtimestamp() #6706
Description
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
- I'm reporting that a supported site is broken
- I've verified that I'm running yt-dlp version 2023.03.04 (update instructions) or later (specify commit)
- I've checked that all provided URLs are playable in a browser with the same IP and same login details
- I've checked that all URLs and arguments with special characters are properly quoted or escaped
- I've searched known issues and the bugtracker for similar issues including closed ones. DO NOT post duplicates
- I've read the guidelines for opening an issue
- I've read about sharing account credentials and I'm willing to share it if required
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 0kBut 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': TruetoYoutubeDLparams instead - Copy the WHOLE output (starting with
[debug] Command-line config) and insert it below
Complete Verbose Output
see above
Activity
chrizilla commentedon Apr 3, 2023
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:
dirkf commentedon Apr 4, 2023
The code is calling
datetime.datetime.fromtimestamp(), whichThis is done inside a
tryblock that handles neitherOverflowErrornorOSError.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.
chrizilla commentedon Apr 4, 2023
Hats off! This is some good detective work, dirkf.
dirkf commentedon Apr 4, 2023
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.
pukkandan commentedon Apr 4, 2023
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.
[-][ARDMediathek] extractor does not like my config file[/-][+][ARDMediathek] unhandled error in datetime.datetime.fromtimestamp()[/+]dirkf commentedon Apr 5, 2023
The
ARDBetaMediathekextractor only returnstimestampand usesunified_timestamp()to extract it. So the problem is just that whatever value is being returned triggers the exception. Guess what? The text date is1960-07-11T23:00:00Zand the resulting timestamp is-298947600.Based on the wording of POSIX.1-2017 4.16 (Seconds Since the Epoch)
time_t-based date-time library functions can't be used reliably if thetime_tmight be negative. That seems to be how Microsoft interpretedtime_tfunctionality forlocaltime_s()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?pukkandan commentedon Apr 5, 2023
dirkf commentedon Apr 5, 2023
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 - 1dissue 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
timedeltato adatetimemakes the latter into a secondtimedelta, adds those (no CRT), and returns the result of combining the date with day ordinaltimedelta.dayswith the time offset part of thetimedelta.Finally, I suppose
(OSError, OverflowError), if not avoided, should causedefaultto be returned. Should a WARNING be made?chrizilla commentedon Apr 6, 2023
pukkandan commentedon Apr 6, 2023
because
timestampis supposed to be the time when video was uploaded to the site. This should probably berelease_timestamp?Anyway, it's not important anymore. dirkf is correct - it's better to patch it than disable it.
chrizilla commentedon Apr 6, 2023
dirkf commentedon Apr 6, 2023
chrizilla commentedon Apr 6, 2023
pukkandan commentedon Apr 7, 2023
[utils] `strftime_or_none`: Handle negative timestamps
[utils] `strftime_or_none`: Handle negative timestamps