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

ERROR: unable to open for writing: [Errno 36] File name too long: #25348

Closed
hadmut opened this issue May 21, 2020 · 0 comments
Closed

ERROR: unable to open for writing: [Errno 36] File name too long: #25348

hadmut opened this issue May 21, 2020 · 0 comments
Labels

Comments

@hadmut
Copy link

@hadmut hadmut commented May 21, 2020

Checklist

  • [ X] I'm reporting a broken site support :

Downloading Videos from Twitter

  • [X ] I've verified that I'm running youtube-dl version 2020.05.08
    % /tmp/youtube-dl -v
    [debug] youtube-dl version 2020.05.08

  • [X ] I've checked that all provided URLs are alive and playable in a browser

youtube-dl 'https://twitter.com/mknrdt/status/1263357611950342145'

  • [ X] I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • [ X] I've searched the bugtracker for similar issues including closed ones

Verbose log

% youtube-dl 'https://twitter.com/mknrdt/status/1263357611950342145'
[twitter] 1263357611950342145: Downloading guest token
[twitter] 1263357611950342145: Downloading JSON metadata
[twitter] 1263357611950342145: Downloading m3u8 information
ERROR: unable to open for writing: [Errno 36] File name too long: "Mathijs Koenraadt - Absolutely shocking footage has emerged from a black male nurse from Detroit (Jadon H.), who filmed himself beating elderly white men into a bloody pulp. 'Get the fuck off my bed, N.,' he is heard saying. Viewer discretion advised.-1263357611950342145.mp4.part"

Description

It might be a general problem and affect other sites as well, but I've observed it for downloadings from twitter only (but many times):

youtube-dl tries to put the whole tweet into the filename and fails because of exceeding the maximum file name length.

In this case the maximum file name length is 255 (ext4 file system) but youtube-dl tries to use around 285 characters

Workaround: give a filename with option -o (cumbersome)

Solution: Use the statfs system call to get the maximum file name length supported by the file system you're trying to write to and shorten the text put into the filename accordingly (i.e. keep and respect the file name endings like .mp4 and .mp4.part, and the tweet number, and just take a fitting number of characters from the tweet).

See
http://man7.org/linux/man-pages/man2/statfs.2.html

@dstftw dstftw closed this May 21, 2020
@dstftw dstftw added the duplicate label May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.