mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-01 03:43:02 +00:00
parent
6b0b0a289a
commit
28786529dc
1 changed files with 17 additions and 10 deletions
|
@ -1,8 +1,8 @@
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from .vimeo import VHXEmbedIE
|
from .vimeo import VHXEmbedIE
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
clean_html,
|
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
clean_html,
|
||||||
get_element_by_class,
|
get_element_by_class,
|
||||||
get_element_by_id,
|
get_element_by_id,
|
||||||
get_elements_by_class,
|
get_elements_by_class,
|
||||||
|
@ -96,11 +96,12 @@ def _get_authenticity_token(self, display_id):
|
||||||
|
|
||||||
def _login(self, display_id):
|
def _login(self, display_id):
|
||||||
username, password = self._get_login_info()
|
username, password = self._get_login_info()
|
||||||
if not (username and password):
|
if not username:
|
||||||
self.raise_login_required(method='password')
|
return True
|
||||||
|
|
||||||
response = self._download_webpage(
|
response = self._download_webpage(
|
||||||
self._LOGIN_URL, display_id, note='Logging in', data=urlencode_postdata({
|
self._LOGIN_URL, display_id, note='Logging in', fatal=False,
|
||||||
|
data=urlencode_postdata({
|
||||||
'email': username,
|
'email': username,
|
||||||
'password': password,
|
'password': password,
|
||||||
'authenticity_token': self._get_authenticity_token(display_id),
|
'authenticity_token': self._get_authenticity_token(display_id),
|
||||||
|
@ -110,19 +111,25 @@ def _login(self, display_id):
|
||||||
user_has_subscription = self._search_regex(
|
user_has_subscription = self._search_regex(
|
||||||
r'user_has_subscription:\s*["\'](.+?)["\']', response, 'subscription status', default='none')
|
r'user_has_subscription:\s*["\'](.+?)["\']', response, 'subscription status', default='none')
|
||||||
if user_has_subscription.lower() == 'true':
|
if user_has_subscription.lower() == 'true':
|
||||||
return response
|
return
|
||||||
elif user_has_subscription.lower() == 'false':
|
elif user_has_subscription.lower() == 'false':
|
||||||
raise ExtractorError('Account is not subscribed')
|
return 'Account is not subscribed'
|
||||||
else:
|
else:
|
||||||
raise ExtractorError('Incorrect username/password')
|
return 'Incorrect username/password'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
display_id = self._match_id(url)
|
display_id = self._match_id(url)
|
||||||
|
login_err, webpage = False, ''
|
||||||
try:
|
try:
|
||||||
self._login(display_id)
|
login_err = self._login(display_id)
|
||||||
webpage = self._download_webpage(url, display_id, note='Downloading video webpage')
|
webpage = self._download_webpage(url, display_id)
|
||||||
finally:
|
finally:
|
||||||
self._download_webpage('https://www.dropout.tv/logout', display_id, note='Logging out', fatal=False)
|
if not login_err:
|
||||||
|
self._download_webpage('https://www.dropout.tv/logout', display_id, note='Logging out', fatal=False)
|
||||||
|
elif '<div id="watch-unauthorized"' in webpage:
|
||||||
|
if login_err is True:
|
||||||
|
self.raise_login_required(method='password')
|
||||||
|
raise ExtractorError(login_err, expected=True)
|
||||||
|
|
||||||
embed_url = self._search_regex(r'embed_url:\s*["\'](.+?)["\']', webpage, 'embed url')
|
embed_url = self._search_regex(r'embed_url:\s*["\'](.+?)["\']', webpage, 'embed url')
|
||||||
thumbnail = self._og_search_thumbnail(webpage)
|
thumbnail = self._og_search_thumbnail(webpage)
|
||||||
|
|
Loading…
Reference in a new issue