From 995cb53e408bde8f13a798cfadbd7f433eada6b7 Mon Sep 17 00:00:00 2001 From: Aniruddh Joshi Date: Mon, 26 Mar 2018 21:35:23 +0530 Subject: [PATCH] [torrins] fixed regex et al. --- youtube_dl/extractor/torrins.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/youtube_dl/extractor/torrins.py b/youtube_dl/extractor/torrins.py index c573c2455..7cc84ed26 100644 --- a/youtube_dl/extractor/torrins.py +++ b/youtube_dl/extractor/torrins.py @@ -16,7 +16,7 @@ class TorrinsIE(InfoExtractor): IE_NAME = 'torrins' _VALID_URL = r'''(?x) https?:// - www\.torrins\.com/(?:guitar|piano|bass)-lessons/(?:song-lessons|style-genre)/[^/]+/(?P[^/]+)/(?P[^(\.)]+)\.html + www\.torrins\.com/(?:guitar|piano|bass)-lessons/(?:song-lessons|style-genre)/[^/]+/(?P[^/]+)/[^\.]+\.html ''' _LOGIN_URL = 'https://www.torrins.com/services/user/sign-in' _ORIGIN_URL = 'https://www.torrins.com' @@ -26,7 +26,6 @@ class TorrinsIE(InfoExtractor): 'url': 'https://www.torrins.com/guitar-lessons/song-lessons/english-songs/another-brick-in-the-wall/song-demo.html', 'info_dict': { 'id': 'another-brick-in-the-wall', - 'lesson_id': 'song-demo', 'ext': 'mp4', 'title': 'Another Brick in the Wall Guitar - Song Demo', 'description': 'md5:c0d51f6f21ef4ec65f091055a5eef876', @@ -38,12 +37,12 @@ class TorrinsIE(InfoExtractor): def _handle_error(self, response): if not isinstance(response, dict): return - error = response.get('error') + error = response['error'] if error: - error_str = 'Torrins returned error #%s: %s' % (error.get('code'), error.get('message')) - error_data = error.get('data') + error_str = 'Torrins returned error #%s: %s' % (error['code'], error.get['message']) + error_data = error['data'] if error_data: - error_str += ' - %s' % error_data.get('formErrors') + error_str += ' - %s' % error_data['formErrors'] raise ExtractorError(error_str, expected=True) def _download_webpage(self, *args, **kwargs): @@ -59,9 +58,6 @@ class TorrinsIE(InfoExtractor): if username is None: return - self._download_webpage( - self._LOGIN_URL, None, 'Downloading login popup') - def is_logged(reason): webpage = self._download_webpage(self._ORIGIN_URL, None, reason) @@ -99,13 +95,10 @@ class TorrinsIE(InfoExtractor): webpage = self._download_webpage(url, course_id) - title = self._og_search_title(webpage) - video_json = self._html_search_regex(r"