YoutubeDownloader icon indicating copy to clipboard operation
YoutubeDownloader copied to clipboard

Invalid file name

Open mostafaznv opened this issue 6 years ago • 15 comments

Hi, thanks for your nice package.

I have a problem with returned $filePath from onFinalized() PATH_TO_FILE\...\videos\FC_Barcelona_vs_FC_Bayern_Munich_2015_(Champions_League_semi-final_Himno,Anthem ).3gp

can you see spaces after ')' ? It seems is not usual parentheses ) as we know I can't generate link to the file! browser return 404 error

original video: https://www.youtube.com/watch?v=sMq_A0ETURQ

mostafaznv avatar May 07 '18 10:05 mostafaznv

Obviously this is related to pathSafeFilename function. There are many possibilities for this to fail, including some non-English characters, some emojis and spaces. PR is always welcome if you would. but there in Filename Sanitizing part of Readme, there is a way to change that function from outside of class. take a look at it.

masihyeganeh avatar May 08 '18 20:05 masihyeganeh

oh sorry! I didn't see it. I will work on it and if I found a better solution, I will send a pull request.

I have another request about this package! is there any way to change cache directory? I mean we can set video and cache directory as second and third parameters of __construct

many thanks.

mostafaznv avatar May 09 '18 05:05 mostafaznv

Hi again I implemented a custom sanitizing function for my own project. in my function, I convert all non-english characters to the same character in english (if you set default language to fa or ar, conversion will be disabled)

feel free to change any part of my code, if you don't like it

mostafaznv avatar May 09 '18 13:05 mostafaznv

any updates?

mostafaznv avatar Jun 30 '18 06:06 mostafaznv

Could you test it again with the latest version? Now using UTF8 package.

masihyeganeh avatar Jun 30 '18 14:06 masihyeganeh

I tested it with latest version (2.9.1)

but unfortunately file name generated with without any success

mostafaznv avatar Jul 16 '18 10:07 mostafaznv

Please give me link to that video

masihyeganeh avatar Jul 16 '18 11:07 masihyeganeh

https://www.youtube.com/watch?v=sMq_A0ETURQ

mostafaznv avatar Jul 16 '18 13:07 mostafaznv

any updates?

mostafaznv avatar Aug 15 '18 04:08 mostafaznv

screen shot 1397-08-06 at 3 12 01 pm

It is working in my PC

masihyeganeh avatar Oct 28 '18 11:10 masihyeganeh

yt

As I said before, the problem is that ending parentheses.

please check attached image and link

mostafaznv avatar Oct 28 '18 12:10 mostafaznv

As you can see, it is downloading the file and no error happened

masihyeganeh avatar Oct 28 '18 18:10 masihyeganeh

Yes I know. it downloaded for me too. but I can't generate download link for that in my website! because file name has unknown characters for browser and browser return 404!

mostafaznv avatar Oct 28 '18 18:10 mostafaznv

It's not the parentheses, it's the ending white space. I'll look into it

On Sun, Oct 28, 2018, 9:47 PM Mostafa Zeinivand [email protected] wrote:

Yes I know. it downloaded for me too. but I can't generate download link for that in my website! because file name has unknown characters for browser and browser return 404!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/masihyeganeh/YoutubeDownloader/issues/41#issuecomment-433728560, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqQb3z-_a2no5yGGERbzh6MGqOYm4kjks5upfTXgaJpZM4T0uF7 .

masihyeganeh avatar Oct 28 '18 18:10 masihyeganeh

screen shot 1397-08-06 at 10 08 21 pm No. It's ending parentheses but I don't know the encoding of character. Please look at picture, It's a unit character I selected.

mostafaznv avatar Oct 28 '18 18:10 mostafaznv