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

Embeded youtube-dl: persist authentication between multiple instances #11301

Closed
brpaz opened this issue Nov 26, 2016 · 1 comment
Closed

Embeded youtube-dl: persist authentication between multiple instances #11301

brpaz opened this issue Nov 26, 2016 · 1 comment

Comments

@brpaz
Copy link

@brpaz brpaz commented Nov 26, 2016

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like that [x])
  • Use Preview tab to see how your issue will actually look like

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

  • [ x] I've verified and I assure that I'm running youtube-dl 2016.11.22

Before submitting an issue make sure you have:

  • [ x] At least skimmed through README and most notably FAQ and BUGS sections
  • [ x] Searched the bugtracker for similar issues including closed ones

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)
  • [ x] Question
  • Other

Description of your issue, suggested solution and other information

Hello.
I am working on a simple python script to be able to backup a list of playlists from Youtube.
The problem is that I have to enter the TFA code for every playlist.
Is there any way I can avoid that? I tried enabling the cookies option but its not working. I think this happens because I am creating a new instance of YoutubeDL for each playlist, but I need to do it, so I can override the output template.

This is the snippet of my code:

  for playlist_id, target_path in playlists.iteritems():
      print colored("Downloading  %s to %s ..." % (playlist_id, target_path ), 'yellow')

      ydl_opts['outtmpl'] = os.path.join(target_path, OUTPUT_FILE_PATTERN)

      ydl = youtube_dl.YoutubeDL(ydl_opts)
      ydl.download([YOUTUBE_PLAYLIST_BASE_URL + playlist_id])

It forces me to enter TFA code for each loop iteration.

Any suggestions to overcome this?
It would be nice if I could just changing the outtmpl property without having to create an entire new YoutubeDL object, but I couldnt find any setter method.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Nov 26, 2016

You may use cookiefile. Or simply change outtmpl with ydl.params['outtmpl'] = ....

@dstftw dstftw closed this Nov 26, 2016
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.