From 41f3c8c54c95027ded515cf9383a769ee0badbc4 Mon Sep 17 00:00:00 2001 From: Quan Hua Date: Tue, 15 Mar 2016 22:45:31 +0700 Subject: [PATCH 1/2] [Udemy] Fix issue 8753 --- youtube_dl/extractor/udemy.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/udemy.py b/youtube_dl/extractor/udemy.py index f5b5e7fd6..f2b2956da 100644 --- a/youtube_dl/extractor/udemy.py +++ b/youtube_dl/extractor/udemy.py @@ -142,9 +142,12 @@ class UdemyIE(InfoExtractor): lecture_id = self._match_id(url) webpage = self._download_webpage(url, lecture_id) - - course_id = self._search_regex( + try: + course_id = self._search_regex( r'data-course-id=["\'](\d+)', webpage, 'course id') + except ExtractorError as e: + course_id = self._search_regex( + r'"id": (\d+)', webpage, 'course id') try: lecture = self._download_lecture(course_id, lecture_id) From a28d4654f3f4136929c772dadb1bc6df25968238 Mon Sep 17 00:00:00 2001 From: Quan Hua Date: Wed, 16 Mar 2016 10:15:39 +0700 Subject: [PATCH 2/2] Change to tuble search_regex to fix #8753 --- youtube_dl/extractor/udemy.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/youtube_dl/extractor/udemy.py b/youtube_dl/extractor/udemy.py index f2b2956da..dc572ac16 100644 --- a/youtube_dl/extractor/udemy.py +++ b/youtube_dl/extractor/udemy.py @@ -142,12 +142,10 @@ class UdemyIE(InfoExtractor): lecture_id = self._match_id(url) webpage = self._download_webpage(url, lecture_id) - try: - course_id = self._search_regex( - r'data-course-id=["\'](\d+)', webpage, 'course id') - except ExtractorError as e: - course_id = self._search_regex( - r'"id": (\d+)', webpage, 'course id') + + course_id = self._search_regex( + (r'data-course-id=["\'](\d+)', r'"id": (\d+)'), + webpage, 'course id') try: lecture = self._download_lecture(course_id, lecture_id)