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

How do I pass `restrictfilenames` in a python script? #16231

Closed
FunkyLoveCow opened this issue Apr 20, 2018 · 1 comment
Closed

How do I pass `restrictfilenames` in a python script? #16231

FunkyLoveCow opened this issue Apr 20, 2018 · 1 comment

Comments

@FunkyLoveCow
Copy link

@FunkyLoveCow FunkyLoveCow commented Apr 20, 2018

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.04.16. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2018.04.16

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

How do I pass restrictfilenames in a python script?

According to this Stack Overflow answer, the restrictfilenames option doesn't require an argument. The example provided, though, is for the command line execution. How do I pass restrictfilenames in ydl_opts?

I have tried both

ydl_opts = {
    'restrictfilenames': True
}

and

ydl_opts = {
    'restrictfilenames': None
}

But when I download the test video I get non-ASCII characters, which is not expected.

ydl_opts = {
    'retrictfilenames': None,
    'outtmpl': "%(title)s-%(id)s-%(resolution)s.%(ext)s",
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    meta = ydl.extract_info(link, download=False)
    print(ydl.prepare_filename(meta))

Output: youtube-dl test video ''_ä↭𝕐-BaW_jenozKc-1920x1080.mp4

The same output occurs with

ydl_opts = {
    'retrictfilenames': None,
    'outtmpl': "%(title)s-%(id)s-%(resolution)s.%(ext)s",
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    meta = ydl.extract_info(link, download=False)
    print(ydl.prepare_filename(meta))

Output: youtube-dl test video ''_ä↭𝕐-BaW_jenozKc-1920x1080.mp4

How do I pass restrictfilenames in a python script?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Apr 20, 2018

restrictfilenames works fine. Incorrect spelling in your code, missing s letter.

@dstftw dstftw closed this Apr 20, 2018
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.