Skip to content

--trim-file-name is inconsistent, doesn't work sometimes #213

Open
@TomArrow

Description

@TomArrow

Checklist

  • I'm reporting a broken site support issue
  • [ X] I've verified that I'm running youtube-dlc version 2020.09.14
  • [ X] I've checked that all provided URLs are alive and playable in a browser
  • [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 bug reports including closed ones
  • I've read bugs section in FAQ
    --

Verbose log

$ youtube-dlc https://twitter.com/IamProvocateur_/status/1340117594938982400 -v
[debug] System config: []
[debug] User config: ['--embed-thumbnail', '--add-metadata', '--ignore-errors', '--write-description', '--write-info-json', '--write-annotations', '--embed-subs', '--include-ads', '--write-thumbnail', '--write-all-thumbnails', '--write-sub', '--write-auto-sub', '--all-subs', '--download-archive', '____youtubeDLdownloaded.txt', '--cookies', 'youtube.txt', '--trim-file-name', '40']
[debug] Custom config: []
[debug] Command-line args: ['https://twitter.com/IamProvocateur_/status/1340117594938982400', '-v']
[debug] Loading archive file '____youtubeDLdownloaded.txt'
[debug] Encodings: locale cp1252, fs utf-8, out cp1252, pref cp1252
[debug] youtube-dlc version 2020.10.09
[debug] Python version 3.8.6 (CPython) - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg 4.2.3, ffprobe git-2019-11-09-0f89a22
[debug] Proxy map: {}
[twitter] 1340117594938982400: Downloading guest token
[twitter] 1340117594938982400: Downloading JSON metadata
[twitter] 1340117594938982400: Downloading m3u8 information
[debug] Default format spec: bestvideo+bestaudio/best
[info] Writing video description to: Bah Humdrea - The small details in sound. Somebody put a broke running toilet in this room lol #Cyberpunk2077 #PS4share-1340117594938982400.description
WARNING: There are no annotations to write.
[info] Writing video description metadata as JSON to: Bah Humdrea - The small details in sound. Somebody put a broke running toilet in this room lol #Cyberpunk2077 #PS4share-1340117594938982400.info.json
ERROR: Cannot write metadata to JSON file Bah Humdrea - The small details in sound. Somebody put a broke running toilet in this room lol #Cyberpunk2077 #PS4share-1340117594938982400.info.json
Traceback (most recent call last):
  File "youtube_dlc\YoutubeDL.py", line 1931, in process_info
  File "youtube_dlc\utils.py", line 1828, in write_json_file
  File "tempfile.py", line 540, in NamedTemporaryFile
  File "tempfile.py", line 250, in _mkstemp_inner
FileNotFoundError: [Errno 2] No such file or directory: 'Bah Humdrea - The small details in sound. Somebody put a broke running toilet in this room lol #Cyberpunk2077 #PS4share-1340117594938982400.info.json.07n6ael_.tmp'
--



Description

Example URLs:
https://twitter.com/leo777_j/status/1340318185959133185
https://twitter.com/News_Sense1/status/1340619358440046592
https://twitter.com/IamProvocateur_/status/1340117594938982400

For most URLs, the --trim-file-name flag seems to be helpful and solve the issue of Windows not being able to write the file. Unfortunately, in some rare cases, it still doesn't work. The three links above for example are not happy with --trim-file-name 50 for me, they require going down to 40 or 30. As you can see, the filename it is trying to write is also clearly longer than 50, it's 139 characters, with the video title part being 105 characters.

So I'm thinking there's some kind of inconsistency there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions