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

File system write error in Windows with long >>title<< parameter in output file name #29975

Open
Tmalll opened this issue Sep 16, 2021 · 4 comments · May be fixed by #29989
Open

File system write error in Windows with long >>title<< parameter in output file name #29975

Tmalll opened this issue Sep 16, 2021 · 4 comments · May be fixed by #29989

Comments

@Tmalll
Copy link

Tmalll commented Sep 16, 2021

image

  1. Excuse , when you use the >>title<< parameter to specify the output file name in windows, if you encounter a long video file name, a file system write error will be reported.
    1.请问,在windows中使用>>title<<参数指定输出文件名的时如果碰到超长的视频文件名称会报出文件系统写入错误.

  2. How do I get the local video name for youtube-dl? I use a proxy server to download a youtube video in China, where I see the video name is a Chinese name, but when I download it using youtube-dl, it becomes In English, I tried other methods such as using cookies and changing IP, and always youtubedl gets an English name. PS: As stated in 1, if you get some videos with very long title names, youtubedl cannot be downloaded under the windows system I guess it is the 255 directory/file name restrictions of the windows system. I can only try to output the download directory to the root directory of the disk to accommodate as many and longer file names as possible.
    2.youtube-dl候如何获取本地视频名称?我在中国使用代理服务器下载一个youtube视频,在我这里我看到此视频名称是一个中文名称,但是使用youtube-dl下载的时候它就变成了英文的,我尝试使用了cookies和更换IP等其他办法,始终youtubedl获取的是一个英文名称.PS:在如1所表述,如果到一些title名字超长的视频,在windows系统下youtubedl就无法下载了.我猜测是windows系统的255目录/文件名等限制.我只能试着把下载目录输出到磁盘的根目录尽量容纳更多更长的文件名.

3.Functional requirements, you can limit the length of the file name when you want to use the title tag to output the file name.
3.功能要求,希望使用title标签输出文件名时可以限制其长度.

@dirkf
Copy link
Contributor

dirkf commented Sep 16, 2021

For points 1 and 3, see #29912 (comment) and the discussion in that issue.

For point 2, possibly if you use -j to list the extracted data as JSON, you might find an extracted parameter that has the Chinese title and then you could use that in your output template instead of title.

@dirkf dirkf linked a pull request Sep 19, 2021 that will close this issue
11 tasks
@Tmalll
Copy link
Author

Tmalll commented Sep 19, 2021

For points 1 and 3, see #29912 (comment) and the discussion in that issue.

For point 2, possibly if you use -j to list the extracted data as JSON, you might find an extracted parameter that has the Chinese title and then you could use that in your output template instead of title.

If you don’t use >>title<< to output the file name, it can indeed solve the problem of the file name being too long, but it will cause great inconvenience in the later retrieval. Because I download the video most of the time to archive the video to prevent YouTube or other video sites delete the video or the publisher removes the video.

I still haven't figured out how to use the two solutions you provided.
1.I tried to output json, but there is no field with Chinese.
2. Regarding the output command to limit the length of the file name, it does not work.

@dirkf
Copy link
Contributor

dirkf commented Sep 19, 2021

...
I still haven't figured out how to use the two solutions you provided.
1.I tried to output json, but there is no field with Chinese.

That's unfortunate, but if no field with the Chinese title is being extracted then yt-dl can't put it in the filename. Perhaps if someone who can read Chinese could study the matter it might be possible to improve the extraction.

  1. Regarding the output command to limit the length of the file name, it does not work.

I'm sure it does, as it has worked for me and others. The output template may need to be quoted on the command line depending on the shell in use (Windows: -o "%(title).50s-%(id)s.%(ext)s"; in a batch file apparently %s have to be doubled: -o "%%(title).50s-%%(id)s.%%(ext)s").

If that doesn't solve the problem, please post your yt-dl command, adding the --get-filename and verbose log (-v) options, together with the command output.

And, as above, I've posted a proposal that would automatically truncate over-long filenames.

@dirkf
Copy link
Contributor

dirkf commented Sep 20, 2021

Also (#10758), try this additional parameter to see if the title is then sent in the desired language: --add-header "Accept-Language: zh-CN" (UNIX-like: "" -> '')

@dirkf dirkf changed the title Excuse, when you use the >>title<< parameter to specify the output file name in windows, if you encounter a long video file name, a file system write error will be reported. File system write error in Windows with long >>title<< parameter in output file name Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants