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 to force login for each video download #13250

Closed
ghost opened this issue Jun 1, 2017 · 2 comments
Closed

How to force login for each video download #13250

ghost opened this issue Jun 1, 2017 · 2 comments

Comments

@ghost
Copy link

@ghost ghost commented Jun 1, 2017

I want to download multiple files using youtube-dl from a site the needs login.

The issue that I have is that youtube-dl is login for the first video with no issue, but doesn't login again for next video.

How do I force youtube-dl to login for each video, every time the function is called ?

def video_download(path, url):

        ydl = youtube_dl.YoutubeDL(
            {
                'outtmpl': path + '.mp4',
                'format': 'bestvideo+bestaudio/best',
                'username': email,
                'password': password,
                'cachedir': False,
                'noplaylist': True
                # 'quiet': True

            })

        with ydl:
            ydl.download([url])
        time.sleep(45)

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jun 1, 2017

Create new instance YoutubeDL for each call of download.

@dstftw dstftw closed this Jun 1, 2017
@ghost
Copy link
Author

@ghost ghost commented Jun 1, 2017

please give me more details. I tried the below code and is not working. Even the code above should have created new instances for each function call.

def video_download(path, url, email, password, i):

    ydl = {}
    ydl[i] = youtube_dl.YoutubeDL( ..

Different instances, the first one is working, the next don't login again:

<youtube_dl.YoutubeDL.YoutubeDL object at 0x0000000004E74C18>
<youtube_dl.YoutubeDL.YoutubeDL object at 0x00000000032BED68>
WARNING: Unable to download kaltura session JSON: HTTP Error 401: UNAUTHORIZED
<youtube_dl.YoutubeDL.YoutubeDL object at 0x0000000004D6D898>
WARNING: Unable to download kaltura session JSON: HTTP Error 401: UNAUTHORIZED

Terminal/Output:

<youtube_dl.YoutubeDL.YoutubeDL object at 0x00000000050E4C18>
[safari] Downloading login form
[safari] Login successful

[safari] 9781787283664/video1_1: Downloading webpage
.............................
<youtube_dl.YoutubeDL.YoutubeDL object at 0x000000000337DD68>
[safari] 9781787283664/video1_2: Downloading webpage
[safari] 9781787283664/video1_2: Downloading kaltura session JSON
WARNING: Unable to download kaltura session JSON: HTTP Error 401: UNAUTHORIZED

@ghost ghost changed the title How to force login everytime How to force login for each video download Jun 1, 2017
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
1 participant
You can’t perform that action at this time.