youtube-dl-php icon indicating copy to clipboard operation
youtube-dl-php copied to clipboard

Need `--trim-filenames` option to be added please!

Open 9x3l6 opened this issue 1 year ago • 4 comments

Please add --trim-filenames because some of the videos I try downloading give error [Errno 36] File name too long: '/tmp/....webp and [Errno 36] File name too long: '/tmp/...description and so on.

See this https://github.com/yt-dlp/yt-dlp/issues/2329#issuecomment-1471348074

Thank you!

9x3l6 avatar Dec 16 '23 08:12 9x3l6

I won't be available until wednesday, so if you need it faster you could contribute :)

norkunas avatar Dec 16 '23 09:12 norkunas

Thanks!

9x3l6 avatar Dec 16 '23 20:12 9x3l6

I'm not sure that this option properly works, because I've tested and getting these results (--trim-filenames 12):

[youtube] oDAw7vW7H0c: Downloading webpage
[youtube] oDAw7vW7H0c: Downloading ios player API JSON
[youtube] oDAw7vW7H0c: Downloading android player API JSON
[youtube] oDAw7vW7H0c: Downloading m3u8 information
[info] oDAw7vW7H0c: Downloading 1 format(s): 247+251
[info] Writing video metadata as JSON to: /home/norkun.info.json
ERROR: Cannot write video metadata to JSON file /home/norkun.info.json

So it looks like that it cuts the download path, not the filename :thinking:

Given that oDAw7vW7H0c title is 10 chars long, it should not truncate at all

you can find the code here: https://github.com/norkunas/youtube-dl-php/tree/trim-filenames

norkunas avatar Dec 20 '23 05:12 norkunas

Ok, I'll verify this when I have a chance and let you know my thoughts. Thanks for the update

9x3l6 avatar Dec 25 '23 14:12 9x3l6