From 39672cdc792e52dd5acc0770553e1b4dd78163c7 Mon Sep 17 00:00:00 2001 From: Hugo Alves De Azevedo Date: Fri, 28 Aug 2020 14:25:37 -0300 Subject: [PATCH] - formatting --- youtube_dl/extractor/alura.py | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/youtube_dl/extractor/alura.py b/youtube_dl/extractor/alura.py index 623187620..9ff2bd347 100644 --- a/youtube_dl/extractor/alura.py +++ b/youtube_dl/extractor/alura.py @@ -29,27 +29,24 @@ class AluraIE(InfoExtractor): 'id': '60095', 'ext': 'mp4', 'title': 'ReferĂȘncias, ref-set e alter' - }, - 'skip': 'Requires alura account credentials', }, + 'skip': 'Requires alura account credentials'}, { # URL without video 'url': 'https://cursos.alura.com.br/course/clojure-mutabilidade-com-atoms-e-refs/task/60098', - 'only_matching': True, - }, + 'only_matching': True}, { 'url': 'https://cursos.alura.com.br/course/fundamentos-market-digital/task/55219', - 'only_matching': True, - } + 'only_matching': True} ] def _real_extract(self, url): video_id = self._match_id(url) course = self._search_regex(self._VALID_URL, url, 'post url', group='course_name') - video_url = self._VIDEO_URL % (course,video_id) + video_url = self._VIDEO_URL % (course, video_id) - video_dict = self._download_json(video_url, None, 'Searching for videos', expected_status=[404,500]) + video_dict = self._download_json(video_url, None, 'Searching for videos', expected_status=[404, 500]) if video_dict: webpage = self._download_webpage(url, video_id) @@ -152,9 +149,21 @@ class AluraCourseIE(AluraIE): page_url = urljoin(url, path) section_path = self._download_webpage(page_url, course_path) for path_video in re.findall(r']* class="[^"]*(?<=[" ])task-menu-nav-item-link-VIDEO[" ])(?=[^>]* href="([^"]*))', section_path): - chapter = clean_html(self._search_regex(r']+class=(["\'])task-menu-section-title-text\1[^>]*>(?P[^<]+)',section_path, 'chapter', group='chapter')) - chapter_number = int_or_none(self._search_regex(r']+class=(["\'])task-menu-section-title-number[^>]*>(.*?)(?P[^<]+)',section_path, 'chapter number', group='chapter_number')) + chapter = clean_html( + self._search_regex( + r']+class=(["\'])task-menu-section-title-text\1[^>]*>(?P[^<]+)', + section_path, + 'chapter', + group='chapter')) + + chapter_number = int_or_none( + self._search_regex( + r']+class=(["\'])task-menu-section-title-number[^>]*>(.*?)(?P[^<]+)', + section_path, + 'chapter number', + group='chapter_number')) video_url = urljoin(url, path_video) + entry = { '_type': 'url_transparent', 'id': self._match_id(video_url), @@ -164,4 +173,4 @@ class AluraCourseIE(AluraIE): 'chapter_number': chapter_number } entries.append(entry) - return self.playlist_result(entries, course_path, course_title) \ No newline at end of file + return self.playlist_result(entries, course_path, course_title)