stitle simply outputs title #405

Closed
opened 2026-02-20 23:03:06 -05:00 by deekerman · 9 comments
Owner

Originally created by @goodevilgenius on GitHub (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"

Originally created by @goodevilgenius on GitHub (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-<id>.mp4", but instead I got "槇原敬之 - COWBOY-q0e61rQZQ6c.mp4"
Author
Owner

@Tailszefox commented on GitHub (Nov 27, 2012):

Per commits b6fab35b9f and 1c469a9480 , 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.

@Tailszefox commented on GitHub (Nov 27, 2012): Per commits b6fab35b9f525cfb5a16e45d8412c6f24c7f621c and 1c469a9480e9d8bea45950898eb46e07b0c58290 , 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.
Author
Owner

@phihag commented on GitHub (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.

@phihag commented on GitHub (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.
Author
Owner

@goodevilgenius commented on GitHub (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

@goodevilgenius commented on GitHub (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
Author
Owner

@Tailszefox commented on GitHub (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.

@Tailszefox commented on GitHub (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.
Author
Owner

@goodevilgenius commented on GitHub (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.

@goodevilgenius commented on GitHub (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.
Author
Owner

@phihag commented on GitHub (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.

@phihag commented on GitHub (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.
Author
Owner

@goodevilgenius commented on GitHub (Nov 27, 2012):

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

@goodevilgenius commented on GitHub (Nov 27, 2012): No problem. I can make do just fine with a few Japanese characters in my filenames for the time being.
Author
Owner

@phihag commented on GitHub (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!

@phihag commented on GitHub (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!
Author
Owner

@goodevilgenius commented on GitHub (Nov 27, 2012):

Thanks! Fantastic!

@goodevilgenius commented on GitHub (Nov 27, 2012): Thanks! Fantastic!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#405
No description provided.