mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-27 19:04:32 +01:00
[intldropout] moved login to VHXEmbedIE
This commit is contained in:
parent
80af001a69
commit
e53f2ee17f
@ -3,10 +3,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from .vimeo import VHXEmbedIE
|
||||
|
||||
from ..utils import (
|
||||
ExtractorError,
|
||||
urlencode_postdata,
|
||||
)
|
||||
from ..utils import ExtractorError
|
||||
|
||||
import re
|
||||
|
||||
@ -54,29 +51,7 @@ class IntlDropoutIE(VHXEmbedIE):
|
||||
email, password = self._get_login_info()
|
||||
if (email is None or password is None) and self._downloader.params.get('cookiefile') is None:
|
||||
raise ExtractorError('No login info available, needed for using %s.' % self.IE_NAME, expected=True)
|
||||
|
||||
login_page = self._download_webpage(
|
||||
self._LOGIN_URL, None,
|
||||
note='Downloading login page',
|
||||
errnote='unable to fetch login page'
|
||||
)
|
||||
|
||||
"""check if user is already logged in via cookies"""
|
||||
if "You are now signed in." in login_page:
|
||||
return
|
||||
|
||||
login_form = self._hidden_inputs(login_page)
|
||||
|
||||
login_form.update({
|
||||
'passwordless': 0,
|
||||
'email': email,
|
||||
'password': password
|
||||
})
|
||||
|
||||
self._download_webpage(self._LOGIN_URL, None, 'Logging in', 'Login failed',
|
||||
expected_status=302,
|
||||
data=urlencode_postdata(login_form),
|
||||
headers={'Content-Type': 'application/x-www-form-urlencoded'})
|
||||
self._vhx_login(email, password, self._LOGIN_URL)
|
||||
|
||||
def _real_extract(self, url):
|
||||
webpage = self._download_webpage(url, None)
|
||||
|
@ -1128,6 +1128,30 @@ class VHXEmbedIE(InfoExtractor):
|
||||
IE_NAME = 'vhx:embed'
|
||||
_VALID_URL = r'https?://embed\.vhx\.tv/videos/(?P<id>\d+)'
|
||||
|
||||
def _vhx_login(self, email, password, login_url):
|
||||
login_page = self._download_webpage(
|
||||
login_url, None,
|
||||
note='Downloading login page',
|
||||
errnote='unable to fetch login page'
|
||||
)
|
||||
|
||||
"""check if user is already logged in via cookies"""
|
||||
if "You are now signed in." in login_page:
|
||||
return
|
||||
|
||||
login_form = self._hidden_inputs(login_page)
|
||||
|
||||
login_form.update({
|
||||
'passwordless': 0,
|
||||
'email': email,
|
||||
'password': password
|
||||
})
|
||||
|
||||
self._download_webpage(login_url, None, 'Logging in', 'Login failed',
|
||||
expected_status=302,
|
||||
data=urlencode_postdata(login_form),
|
||||
headers={'Content-Type': 'application/x-www-form-urlencoded'})
|
||||
|
||||
def _call_api(self, video_id, access_token, path='', query=None):
|
||||
return self._download_json(
|
||||
'https://api.vhx.tv/videos/' + video_id + path, video_id, headers={
|
||||
|
Loading…
Reference in New Issue
Block a user