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

Youtube: Issue with "youtube-dl -t" and blanks in filename - no underscores since update #609

Closed
ghost opened this issue Dec 30, 2012 · 4 comments

Comments

@ghost
Copy link

@ghost ghost commented Dec 30, 2012

I installed youtube-dl with MacPorts. Did a "port upgrade outdated" and now I see that there are whitespaces in file name. In earlier version was underscore _

> youtube-dl --version
2012.12.11

> youtube-dl -t https://www.youtube.com/watch?v=9vLnfWT9wQ8
[youtube] Setting language
[youtube] 9vLnfWT9wQ8: Downloading video webpage
[youtube] 9vLnfWT9wQ8: Downloading video info webpage
[youtube] 9vLnfWT9wQ8: Extracting video information
[download] Destination: Puppy's First Christmas-9vLnfWT9wQ8.mp4
[download] 100.0% of 39.08M at    1.69M/s ETA 00:00

> ls -al Puppy*
-rw-r--r--  1 Peter  staff  40979259 Dec 24 23:14 Puppy's First Christmas-9vLnfWT9wQ8.mp4

Whitespaces are really bad for UNIX like OSes.

@phihag
Copy link
Contributor

@phihag phihag commented Dec 30, 2012

This is intentional. I have no idea why whitespaces should be bad for Unix, could you elaborate? They work just fine on my Linux box.

In any case, you can pass --restrict-filenames to restrict the filename characters to a more limited set. If you want that all the time, just add /etc/youtube-dl.conf or ~/.local/config/youtube-dl.conf with the contents --restrict-filenames.

@phihag phihag closed this Dec 30, 2012
@ghost
Copy link
Author

@ghost ghost commented Dec 30, 2012

Whiespaces and other special characters

# pound < left angle bracket    $ dollar sign   + plus sign
% percent   > right angle bracket   ! exclamation point ` backtick
& ampersand * asterisk  ‘ single quotes   | pipe
{ left bracket  ? question mark “ double quotes   = equal sign
} right bracket / forward slash : colon  
\ back slash    blank spaces    @ at sign

need quoting in UNIX.

Jeff Atwood wrote http://www.codinghorror.com/blog/2006/04/of-spaces-underscores-and-dashes.html:

I try to avoid using spaces in filenames and URLs. They're great for human readability, but they're remarkably inconvenient in computer resource locators:

See https://en.wikipedia.org/wiki/Jeff_Atwood for more info about Jeff Atwood.

why is it intentional? why you include blanks?

@phihag
Copy link
Contributor

@phihag phihag commented Dec 30, 2012

No, they don't, you can call fopen("white space") just fine. Some of these characters need to be escaped in various places in a POSIX-compatible shell. Any modern interactive shell will do the quoting for you - simply press Tab or use placeholders.

While underscores instead of spaces are fairly readable, the other replacements are not. I'd very much prefer a title <script> - "security" in .coms.mp4 than _script__-__security__in_.coms.mp4. Therefore, we decided (after a lot of requests for spaces in file names) to have the file name as plainly as possible, without any rewriting, and add the aforementioned --restrict-filenames option for people on systems that cannot handle the glory of plain filenames.

@njsg
Copy link

@njsg njsg commented Nov 30, 2014

Count this as one more request against spaces in file names. While it is possible to use almost every character in a file name, I still prefer to avoid anything far from lowercase ASCII, including blanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.