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

Video slug not sanitized resulting in failure to download Twitter video #7709

Closed
10 of 11 tasks
Mattwmaster58 opened this issue Jul 27, 2023 · 3 comments
Closed
10 of 11 tasks
Labels
question Question

Comments

@Mattwmaster58
Copy link

Mattwmaster58 commented Jul 27, 2023

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

USA

Provide a description that is worded well enough to be understood

Downloading videos from twitter where the tweet contains illegal file name characters causes the download to fail on windows
Example URL: https://twitter.com/WallStreetSilv/status/1684272379424301073?s=20

When I specify output manually (-o out.mp4) everything downloads as expected.

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

PS C:\Users\username\Downloads> yt-dlp -vU "https://twitter.com/WallStreetSilv/status/1684272379424301073?s=20" --cookies-from-browser firefox
[debug] Command-line config: ['-vU', 'https://twitter.com/WallStreetSilv/status/1684272379424301073?s=20', '--cookies-from-browser', 'firefox']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.07.06 [b532a3481] (pip)
[debug] Python 3.11.3 (CPython AMD64 64bit) - Windows-10-10.0.22621-SP0 (OpenSSL 1.1.1t  7 Feb 2023)
[debug] exe versions: ffmpeg 6.0-full_build-www.gyan.dev (setts), ffprobe 6.0-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[Cookies] Extracting cookies from firefox
[debug] Extracting cookies from: "C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\va5soqjb.default-nightly\cookies.sqlite"
[Cookies] Extracted 1669 cookies from firefox
[debug] Proxy map: {}
[debug] Loaded 1855 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.07.06, Current version: stable@2023.07.06
yt-dlp is up to date (stable@2023.07.06)
[twitter] Extracting URL: https://twitter.com/WallStreetSilv/status/1684272379424301073?s=20

[twitter] 1684272379424301073: Downloading GraphQL JSON
[debug] [twitter] Extracting from video info: 1684263716022255649
[twitter] 1684272379424301073: Downloading m3u8 information
[debug] Sort order given by extractor: res, br, size, proto
[debug] Formats sorted by: hasvid, ie_pref, res, br, size, proto, lang, quality, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, asr, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 1684263716022255649: Downloading 1 format(s): http-2176
[debug] Invoking http downloader on "https://video.twimg.com/ext_tw_video/1684263716022255649/pu/vid/1280x720/YGV5DqflzQORerka.mp4?tag=12"
[download] Unable to open file: [Errno 22] Invalid argument: "Wall Street Silver - Maybe it's time for some new people?  Mitch McConnell stops talking and has to be escorted away.  Mitch McConnell 81 Joe Biden 80 Nancy Pelosi 83 Maxine Waters 84 Chuck Grassley 89 Dianne Feinstein 90 Klaus Schwab 85 George Soros 92  🔊 [1684263716022255649].mp4.part". Retrying (1/3)...
[download] Unable to open file: [Errno 22] Invalid argument: "Wall Street Silver - Maybe it's time for some new people?  Mitch McConnell stops talking and has to be escorted away.  Mitch McConnell 81 Joe Biden 80 Nancy Pelosi 83 Maxine Waters 84 Chuck Grassley 89 Dianne Feinstein 90 Klaus Schwab 85 George Soros 92  🔊 [1684263716022255649].mp4.part". Retrying (2/3)...
[download] Unable to open file: [Errno 22] Invalid argument: "Wall Street Silver - Maybe it's time for some new people?  Mitch McConnell stops talking and has to be escorted away.  Mitch McConnell 81 Joe Biden 80 Nancy Pelosi 83 Maxine Waters 84 Chuck Grassley 89 Dianne Feinstein 90 Klaus Schwab 85 George Soros 92  🔊 [1684263716022255649].mp4.part". Retrying (3/3)...
ERROR: unable to open for writing: [Errno 22] Invalid argument: "Wall Street Silver - Maybe it's time for some new people?  Mitch McConnell stops talking and has to be escorted away.  Mitch McConnell 81 Joe Biden 80 Nancy Pelosi 83 Maxine Waters 84 Chuck Grassley 89 Dianne Feinstein 90 Klaus Schwab 85 George Soros 92  🔊 [1684263716022255649].mp4.part"
Traceback (most recent call last):
  File "C:\Users\username\.local\pipx\venvs\yt-dlp\Lib\site-packages\yt_dlp\utils\_utils.py", line 662, in sanitize_open
    raise LockingUnsupportedError()
yt_dlp.utils.LockingUnsupportedError: File locking is not supported

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\username\.local\pipx\venvs\yt-dlp\Lib\site-packages\yt_dlp\downloader\http.py", line 273, in download
    ctx.stream, ctx.tmpfilename = self.sanitize_open(
                                  ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\.local\pipx\venvs\yt-dlp\Lib\site-packages\yt_dlp\downloader\common.py", line 239, in wrapper
    for retry in RetryManager(self.params.get('file_access_retries', 3), error_callback, fd=self):
  File "C:\Users\username\.local\pipx\venvs\yt-dlp\Lib\site-packages\yt_dlp\utils\_utils.py", line 5634, in __iter__
    self.error_callback(self.error, self.attempt, self.retries)
  File "C:\Users\username\.local\pipx\venvs\yt-dlp\Lib\site-packages\yt_dlp\downloader\common.py", line 232, in error_callback
    return RetryManager.report_retry(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\.local\pipx\venvs\yt-dlp\Lib\site-packages\yt_dlp\utils\_utils.py", line 5642, in report_retry
    raise e
  File "C:\Users\username\.local\pipx\venvs\yt-dlp\Lib\site-packages\yt_dlp\downloader\common.py", line 241, in wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\.local\pipx\venvs\yt-dlp\Lib\site-packages\yt_dlp\downloader\common.py", line 252, in sanitize_open
    f, filename = sanitize_open(filename, open_mode)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\.local\pipx\venvs\yt-dlp\Lib\site-packages\yt_dlp\utils\_utils.py", line 665, in sanitize_open
    stream = open(filename, open_mode)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 22] Invalid argument: "Wall Street Silver - Maybe it's time for some new people?  Mitch McConnell stops talking and has to be escorted away.  Mitch McConnell 81 Joe Biden 80 Nancy Pelosi 83 Maxine Waters 84 Chuck Grassley 89 Dianne Feinstein 90 Klaus Schwab 85 George Soros 92  🔊 [1684263716022255649].mp4.part"
@Mattwmaster58 Mattwmaster58 added site-bug Issue with a specific website triage Untriaged issue labels Jul 27, 2023
@bashonly
Copy link
Member

it's erroring because the filename is too long, not because of illegal chars

mitigate this with output template: -o "%(title).150B [%(id)s].%(ext)s"
(or decrease to .100B etc if that still doesn't work)

@bashonly bashonly added question Question and removed site-bug Issue with a specific website triage Untriaged issue labels Jul 27, 2023
@Mattwmaster58
Copy link
Author

I see. Shouldn't this be handled by the windows filename sanitization, or is this a path length limitation (as opposed to file name length)

@bashonly
Copy link
Member

bashonly commented Jul 27, 2023

it's because of windows' path length limit

related #1136 (in FAQ)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question
Projects
None yet
Development

No branches or pull requests

2 participants