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

stitle simply outputs title #551

Closed
goodevilgenius opened this issue Nov 27, 2012 · 9 comments
Closed

stitle simply outputs title #551

goodevilgenius opened this issue Nov 27, 2012 · 9 comments

Comments

@goodevilgenius
Copy link

@goodevilgenius goodevilgenius commented Nov 27, 2012

As of 2012.11.17, stitle is the same as title.

I tried youtube-dl -o "%(stitle)s-%(id)s.%(ext)s" "<url>" and youtube-dl -o "%(title)s-%(id)s.%(ext)s" "<url>" with several different <url>s and got the exact same filename each time, complete with extended characters, including non-ASCII characters.

For example youtube-dl -f 18 -o "%(stitle)s-%(id)s.%(ext)s" 'http://www.youtube.com/watch?v=q0e61rQZQ6c', I would expect to give me a file named "COWBOY-.mp4", but instead I got "槇原敬之 - COWBOY-q0e61rQZQ6c.mp4"

@Tailszefox
Copy link
Contributor

@Tailszefox Tailszefox commented Nov 27, 2012

Per commits b6fab35 and 1c469a9 , stitle is now the same as title (or rather, title is the same as stitle), and you have to use the --restrict-filenames option if you want a "clean" title. Using the following command line results in a ASCII-only title:

% ./youtube-dl --restrict-filenames -f 18 -o "%(title)s-%(id)s.%(ext)s" 'http://www.youtube.com/watch?v=q0e61rQZQ6c'
[youtube] Setting language
[youtube] q0e61rQZQ6c: Downloading video webpage
[youtube] q0e61rQZQ6c: Downloading video info webpage
[youtube] q0e61rQZQ6c: Extracting video information
[download] Destination: -_COWBOY-q0e61rQZQ6c.mp4
[download]   0.3% of 23.92M at   66.86k/s ETA 06:05^C

Make sure you're using and have compiled the latest version from the repository, since these were introduced recently.

@phihag
Copy link
Contributor

@phihag phihag commented Nov 27, 2012

The behavior of stitle predates 2012.11.17, and is intentional. Basically, most people want COWBÖYS to show up as such.

stitle is deprecated (2012.11.27b and newer will show a warning). It was a hack which only modified the title, and not the other fields (for example, -o '%(uploader)s-%(stitle)s' could still contain special characters, and even slashes!).

Instead, use the new --restrict-filenames option, which covers all fields, not only the title.

@goodevilgenius
Copy link
Author

@goodevilgenius goodevilgenius commented Nov 27, 2012

I see. Then the the documentation at http://rg3.github.com/youtube-dl/documentation.html needs to be updated.

Furthermore, --restrict-filenames doesn't eliminate all non-ASCII characters, only European ones. It leaves in Chinese/Japanese/Korean/etc. characters.

E.g., youtube-dl --get-filename --restrict-filenames -o "%(uploader)s-%(stitle)s-%(id)s.%(ext)s" 'http://www.youtube.com/watch?v=q0e61rQZQ6c' outputs warnermusicjapan-槇原敬之_-COWBOY-q0e61rQZQ6c.flv whereas I would expect it to be warnermusicjapan--_COWBOY-q0e61rQZQ6c.flv

@Tailszefox
Copy link
Contributor

@Tailszefox Tailszefox commented Nov 27, 2012

Weird, with that option I do get a ASCII-only title:

% youtube-dl --get-filename --restrict-filenames -o "%(uploader)s-%(title)s-%(id)s.%(ext)s" 'http://www.youtube.com/watch?v=q0e61rQZQ6c'  
warnermusicjapan-_-_COWBOY-q0e61rQZQ6c.flv

Are you using the latest version? On which OS and with which version of Python? That may have something to do with hat.

@goodevilgenius
Copy link
Author

@goodevilgenius goodevilgenius commented Nov 27, 2012

I'm using 2012.11.27. I just today updated it with youtube-dl -U on Ubuntu Linux 12.04, with python 2.7.3.

@phihag
Copy link
Contributor

@phihag phihag commented Nov 27, 2012

@goodevilgenius Sorry, the new 2012.11.27b release is not up yet, I'm still having problems with the Windows build.

I'm also updating the webpage documentation, thanks for noticing.

@goodevilgenius
Copy link
Author

@goodevilgenius goodevilgenius commented Nov 27, 2012

No problem. I can make do just fine with a few Japanese characters in my filenames for the time being.

@phihag
Copy link
Contributor

@phihag phihag commented Nov 27, 2012

All done in 2012.12.28, so feel free to update. If you pass --restrict-filenames, you'll the filename you originally wanted :). Thanks for reporting!

@goodevilgenius
Copy link
Author

@goodevilgenius goodevilgenius commented Nov 27, 2012

Thanks! Fantastic!

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
3 participants
You can’t perform that action at this time.