From a787465d8a647be49d21292833c603e2d83f655a Mon Sep 17 00:00:00 2001 From: Thomas Tsiakalakis Date: Mon, 18 Mar 2019 09:49:59 +0100 Subject: [PATCH] [intldropout] implemented feedback --- youtube_dl/extractor/intldropout.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/youtube_dl/extractor/intldropout.py b/youtube_dl/extractor/intldropout.py index 98bebf042..d2dbe4b7d 100644 --- a/youtube_dl/extractor/intldropout.py +++ b/youtube_dl/extractor/intldropout.py @@ -5,7 +5,6 @@ from .vimeo import VHXEmbedIE from ..utils import ( ExtractorError, - sanitized_Request, urlencode_postdata, ) @@ -75,27 +74,22 @@ class IntlDropoutIE(VHXEmbedIE): 'password': password }) - request = sanitized_Request( - self._LOGIN_URL, urlencode_postdata(login_form)) - request.add_header('Content-Type', 'application/x-www-form-urlencoded') - try: - self._download_webpage(request, None, 'Logging in', expected_status=302) - except Exception: - raise ExtractorError( - 'Unable to login', - expected=True) + 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'}) def _real_extract(self, url): webpage = self._download_webpage(url, None) video = self._html_search_regex(r']*"(?Phttps://embed.vhx.tv/videos/[0-9]+[^"]*)"[^>]*>', webpage, 'embed') video_id = self._search_regex(r'https://embed.vhx.tv/videos/(?P[0-9]+)', video, 'id') - video_title = self._html_search_regex(r'

]*>(?P[^<]+)<', webpage, 'title') + video_title = self._html_search_regex(r'<h1 class="[^"]*video-title[^"]*"[^>]*><strong>(?P<title>[^<]+)<', webpage, 'title', fatal=False) return self.url_result(video, video_id=video_id, video_title=video_title) class IntlDropoutPlaylistIE(IntlDropoutIE): IE_NAME = 'intldropout:playlist' - _VALID_URL = r'^https://intl\.dropout\.tv/(?P<id>.+)' + _VALID_URL = r'https://intl\.dropout\.tv/(?P<id>.+)' _TESTS = [ { 'url': 'https://intl.dropout.tv/um-actually-the-web-series', @@ -131,7 +125,7 @@ class IntlDropoutPlaylistIE(IntlDropoutIE): return False if IntlDropoutIE.suitable(url) else super(IntlDropoutPlaylistIE, cls).suitable(url) def _real_extract(self, url): - playlist_id = self._search_regex(r'https://intl.dropout.tv/(?P<id>.+)', url, 'id') + playlist_id = self._match_id(url) webpage = self._download_webpage(url, playlist_id) items = re.findall(r'browse-item-title[^>]+>[^<]*<a href="(?P<url>https://intl.dropout.tv/[^/]+/[^"]+)"', webpage) playlist_title = self._html_search_regex(r'<h1 class="[^"]*collection-title[^"]*"[^>]*>(?P<title>[^<]+)<', webpage, 'title')