[udemy] Improve course id v4 regex
[youtube-dl] / youtube_dl / extractor / udemy.py
index e19c1f762b4733099e4c837a068a31237829b723..74cc36ece2cb66da6c039af384763bdd95222d14 100644 (file)
@@ -41,7 +41,7 @@ class UdemyIE(InfoExtractor):
             webpage, 'checkout url', group='url', default=None))
         if checkout_url:
             raise ExtractorError(
-                'Course %s is not free. You have to pay for it before you can download.'
+                'Course %s is not free. You have to pay for it before you can download. '
                 'Use this URL to confirm purchase: %s' % (course_id, checkout_url), expected=True)
 
         enroll_url = unescapeHTML(self._search_regex(
@@ -144,7 +144,8 @@ class UdemyIE(InfoExtractor):
         webpage = self._download_webpage(url, lecture_id)
 
         course_id = self._search_regex(
-            r'data-course-id=["\'](\d+)', webpage, 'course id')
+            (r'data-course-id=["\'](\d+)', r'"id"\s*:\s*(\d+)'),
+            webpage, 'course id')
 
         try:
             lecture = self._download_lecture(course_id, lecture_id)