ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.96k stars 10.01k forks source link

"File name too long" for .info.json.xxxxxxxx.tmp file #7217

Closed ivan closed 2 years ago

ivan commented 9 years ago

This works on Windows, but on Linux, the filename is too long:

# PYTHONPATH=. python3 -m youtube_dl --verbose --title --write-info-json "n_8yNCMM2_0"     
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['--verbose', '--title', '--write-info-json', 'n_8yNCMM2_0']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2015.10.16
[debug] Git HEAD: 49941c4
[debug] Python version 3.4.3 - Linux-3.19.0-30-generic-x86_64-with-Ubuntu-14.04-trusty
[debug] exe versions: none
[debug] Proxy map: {}
[youtube] n_8yNCMM2_0: Downloading webpage
[youtube] n_8yNCMM2_0: Downloading video info webpage
[youtube] n_8yNCMM2_0: Extracting video information
[youtube] {43} signature length 40.43, html5 player new-en_US-vflDpriqR
[youtube] {18} signature length 40.43, html5 player new-en_US-vflDpriqR
[youtube] {5} signature length 40.43, html5 player new-en_US-vflDpriqR
[youtube] {36} signature length 40.43, html5 player new-en_US-vflDpriqR
[youtube] {17} signature length 40.43, html5 player new-en_US-vflDpriqR
[youtube] {134} signature length 40.43, html5 player new-en_US-vflDpriqR
[youtube] {243} signature length 40.43, html5 player new-en_US-vflDpriqR
[youtube] {133} signature length 40.43, html5 player new-en_US-vflDpriqR
[youtube] {242} signature length 40.43, html5 player new-en_US-vflDpriqR
[youtube] {160} signature length 40.43, html5 player new-en_US-vflDpriqR
[youtube] {140} signature length 40.43, html5 player new-en_US-vflDpriqR
[youtube] {171} signature length 40.43, html5 player new-en_US-vflDpriqR
[youtube] {249} signature length 40.43, html5 player new-en_US-vflDpriqR
[youtube] {250} signature length 40.43, html5 player new-en_US-vflDpriqR
[youtube] {251} signature length 40.43, html5 player new-en_US-vflDpriqR
[youtube] n_8yNCMM2_0: Downloading DASH manifest
[info] Writing video description metadata as JSON to: 青山ロックンロール・レイディオ Vol.17~今回はフランキー・ヴァリにMASTERS OF POP、さらに9_24発売の充実でお買い得な『2CDベスト1800』シリーズを一気にご紹介!-n_8yNCMM2_0.info.json
ERROR: Cannot write metadata to JSON file 青山ロックンロール・レイディオ Vol.17~今回はフランキー・ヴァリにMASTERS OF POP、さらに9_24発売の充実でお買い得な『2CDベスト1800』シリーズを一気にご紹介!-n_8yNCMM2_0.info.json
Traceback (most recent call last):
  File "/home/at/yt/youtube-dl/youtube_dl/YoutubeDL.py", line 1524, in process_info
    write_json_file(self.filter_requested_info(info_dict), infofn)
  File "/home/at/yt/youtube-dl/youtube_dl/utils.py", line 120, in write_json_file
    tf = tempfile.NamedTemporaryFile(**compat_kwargs(args))
  File "/usr/lib/python3.4/tempfile.py", line 599, in NamedTemporaryFile
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
  File "/usr/lib/python3.4/tempfile.py", line 339, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
OSError: [Errno 36] File name too long: '青山ロックンロール・レイディオ\u3000Vol.17~今回はフランキー・ヴァリにMASTERS OF POP、さらに9_24発売の充実でお買い得な『2CDベスト1800』シリーズを一気にご紹介!-n_8yNCMM2_0.info.json.s0v5rpkk.tmp'
yan12125 commented 9 years ago

There's a fix at #6442, which is still under discussion.

Tatsh commented 6 years ago

If it is acceptable, truncate the title: --output '%(title).128s-%(id)s.%(ext)s