Skip to content
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

Download fails when the title of the video is too long (or contains invalid characters) #2088

Closed
6 tasks done
abolibibelot1980 opened this issue Dec 22, 2021 · 1 comment
Closed
6 tasks done
Labels
bug Bug that is not site-specific duplicate This issue or pull request already exists

Comments

@abolibibelot1980
Copy link

Checklist

  • I'm reporting a bug unrelated to a specific site
  • I've verified that I'm running yt-dlp version 2021.12.01. (update instructions)
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar issues including closed ones. DO NOT post duplicates
  • I've read the guidelines for opening an issue

Description

The download fails with the basic syntax when a video's title is longer than the max path length allowed on the operating system (in this case Windows 7), and/or contains invalid characters (in the example below I'm not sure which of those two possible causes is the actual culprit as the video's title has both characteristics), with a misleading error message saying “No such file or directory”. The download starts normally if a shorter / valid file name is specified for the output.

So yt-dlp should shorten the automatically generated output file name to a length below the limit of the current system (and replace any invalid characters with placeholder characters), or prompt the user with a (non misleading) warning and a request to manually input a valid output file name.

Verbose log

H:\>yt-dlp -Uv https://twitter.com/i/status/1473417773372030981
[debug] Command-line config: ['-Uv', 'https://twitter.com/i/status/1473417773372030981']
[debug] Encodings: locale cp1252, fs utf-8, out utf-8 (No ANSI), err utf-8 (No ANSI), pref cp1252
[debug] yt-dlp version 2021.12.01 [91f071a] (win_exe)
[debug] Python version 3.8.10 (CPython 64bit) - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg 4.2.3, ffprobe git-2019-12-26-b0d0d7e
[debug] Optional libraries: Cryptodome, mutagen, sqlite, websockets
[debug] Proxy map: {}
Latest version: 2021.12.01, Current version: 2021.12.01
yt-dlp is up to date (2021.12.01)
[debug] [twitter] Extracting URL: https://twitter.com/i/status/1473417773372030981
[twitter] 1473417773372030981: Downloading guest token
[twitter] 1473417773372030981: Downloading JSON metadata
[twitter] 1473417773372030981: Downloading m3u8 information
[debug] Sort order given by extractor: res, br, size, proto
[debug] Formats sorted by: hasvid, ie_pref, res, tbr, vbr, abr, filesize, fs_approx, proto, lang, quality, fps, hdr:12(7), vcodec:vp9.2(10), acodec, asr, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 1473417773372030981: Downloading 1 format(s): http-2176
[debug] Invoking downloader on "https://video.twimg.com/amplify_video/1473414109798576137/vid/1280x720/I7DLU-AQFjaR6gJn.mp4?tag=14"
ERROR: unable to open for writing: [Errno 2] No such file or directory: 'Alexandria Ocasio-Cortez - We're back-back-back again!  Despite the challenges, we've accomplished so much together over the past year. Thank you to EVERYONE who zoomed, taught, organized, and built community with us.  Without further ado - 21 wins for 2021. Want to join for '22 ?? [1473417773372030981].mp4.part'
Traceback (most recent call last):
  File "yt_dlp\downloader\http.py", line 266, in download
  File "yt_dlp\utils.py", line 2094, in sanitize_open
FileNotFoundError: [Errno 2] No such file or directory: 'Alexandria Ocasio-Cortez - We're back-back-back again!  Despite the challenges, we've accomplished so much together over the past year. Thank you to EVERYONE who zoomed, taught, organized, and built community with us.  Without further ado - 21 wins for 2021. Want to join for '22 ?? [1473417773372030981].mp4.part'

H:\>yt-dlp -Uv https://twitter.com/i/status/1473417773372030981 -o "Alexandria Ocasio-Cortez - We're back-back-back again!.mp4"
[debug] Command-line config: ['-Uv', 'https://twitter.com/i/status/1473417773372030981', '-o', "Alexandria Ocasio-Cortez - We're back-back-back again!.mp4"]
[debug] Encodings: locale cp1252, fs utf-8, out utf-8 (No ANSI), err utf-8 (No ANSI), pref cp1252
[debug] yt-dlp version 2021.12.01 [91f071a] (win_exe)
[debug] Python version 3.8.10 (CPython 64bit) - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg 4.2.3, ffprobe git-2019-12-26-b0d0d7e
[debug] Optional libraries: Cryptodome, mutagen, sqlite, websockets
[debug] Proxy map: {}
Latest version: 2021.12.01, Current version: 2021.12.01
yt-dlp is up to date (2021.12.01)
[debug] [twitter] Extracting URL: https://twitter.com/i/status/1473417773372030981
[twitter] 1473417773372030981: Downloading guest token
[twitter] 1473417773372030981: Downloading JSON metadata
[twitter] 1473417773372030981: Downloading m3u8 information
[debug] Sort order given by extractor: res, br, size, proto
[debug] Formats sorted by: hasvid, ie_pref, res, tbr, vbr, abr, filesize, fs_approx, proto, lang, quality, fps, hdr:12(7), vcodec:vp9.2(10), acodec, asr, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 1473417773372030981: Downloading 1 format(s): http-2176
[debug] Invoking downloader on "https://video.twimg.com/amplify_video/1473414109798576137/vid/1280x720/I7DLU-AQFjaR6gJn.mp4?tag=14"
[download] Destination: Alexandria Ocasio-Cortez - We're back-back-back again!.mp4
[download]  15.3% of 27.67MiB at  1.10MiB/s ETA 00:21
@abolibibelot1980 abolibibelot1980 added bug Bug that is not site-specific triage Untriaged issue labels Dec 22, 2021
@pukkandan
Copy link
Member

Invalid characters are already handled. The issue is with long filenames. Duplicate of #1136

@pukkandan pukkandan added duplicate This issue or pull request already exists and removed triage Untriaged issue labels Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that is not site-specific duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants