1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-24 01:14:32 +01:00

[intldropout] better login checks

This commit is contained in:
Thomas Tsiakalakis 2019-04-26 19:19:22 +02:00
parent f7f9c27896
commit 12a7c5e8c2

View File

@ -52,20 +52,16 @@ class IntlDropoutIE(VHXEmbedIE):
def _login(self): def _login(self):
email, password = self._get_login_info() email, password = self._get_login_info()
if email is None or password is None: if (email is None or password is None) and self._downloader.params.get('cookiefile') is None:
if self._downloader.params.get('cookiefile') is None:
raise ExtractorError('No login info available, needed for using %s.' % self.IE_NAME, expected=True) raise ExtractorError('No login info available, needed for using %s.' % self.IE_NAME, expected=True)
return True
login_page = self._download_webpage( login_page = self._download_webpage(
self._LOGIN_URL, None, self._LOGIN_URL, None,
note='Downloading login page', note='Downloading login page',
errnote='unable to fetch login page', fatal=False errnote='unable to fetch login page'
) )
if login_page is False: """check if user is already logged in via cookies"""
return
if "You are now signed in." in login_page: if "You are now signed in." in login_page:
return return
@ -86,6 +82,9 @@ class IntlDropoutIE(VHXEmbedIE):
webpage = self._download_webpage(url, None) webpage = self._download_webpage(url, None)
if "The device limit for your account has been reached" in webpage: if "The device limit for your account has been reached" in webpage:
raise ExtractorError('Device Limit reached', expected=True) raise ExtractorError('Device Limit reached', expected=True)
if "Start your free trial" in webpage or "Start Free Trial" in webpage or "Sign in" in webpage:
raise ExtractorError('You don\'t seem to be logged in', expected=True)
video = self._html_search_regex(r'<iframe[^>]*"(?P<embed>https://embed.vhx.tv/videos/[0-9]+[^"]*)"[^>]*>', webpage, 'embed') video = self._html_search_regex(r'<iframe[^>]*"(?P<embed>https://embed.vhx.tv/videos/[0-9]+[^"]*)"[^>]*>', webpage, 'embed')
video_id = self._search_regex(r'https://embed.vhx.tv/videos/(?P<id>[0-9]+)', video, 'id') video_id = self._search_regex(r'https://embed.vhx.tv/videos/(?P<id>[0-9]+)', video, 'id')
video_title = self._html_search_regex(r'<h1 class="[^"]*video-title[^"]*"[^>]*><strong>(?P<title>[^<]+)<', webpage, 'title', fatal=False) video_title = self._html_search_regex(r'<h1 class="[^"]*video-title[^"]*"[^>]*><strong>(?P<title>[^<]+)<', webpage, 'title', fatal=False)