diff options
author | sprhawk <465558+sprhawk@users.noreply.github.com> | 2017-12-26 22:27:26 +0800 |
---|---|---|
committer | sprhawk <465558+sprhawk@users.noreply.github.com> | 2017-12-26 22:27:26 +0800 |
commit | c33de004e13da11f1ae3cad7310b36500cfb9d28 (patch) | |
tree | c742e448af6c126eca4b259c85f83177aec54847 /youtube_dl/extractor/udemy.py | |
parent | 42a1012c7767306626c5358a18ad3e86417bd7b7 (diff) | |
parent | db145ee54a57f5ccc89639de8c589eb111a91b19 (diff) |
Merge branch 'master' of github.com:rg3/youtube-dl into weibo
Diffstat (limited to 'youtube_dl/extractor/udemy.py')
-rw-r--r-- | youtube_dl/extractor/udemy.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/youtube_dl/extractor/udemy.py b/youtube_dl/extractor/udemy.py index c248ea727..195f5ce78 100644 --- a/youtube_dl/extractor/udemy.py +++ b/youtube_dl/extractor/udemy.py @@ -62,11 +62,11 @@ class UdemyIE(InfoExtractor): def _extract_course_info(self, webpage, video_id): course = self._parse_json( unescapeHTML(self._search_regex( - r'ng-init=["\'].*\bcourse=({.+?});', webpage, 'course', default='{}')), + r'ng-init=["\'].*\bcourse=({.+?})[;"\']', + webpage, 'course', default='{}')), video_id, fatal=False) or {} course_id = course.get('id') or self._search_regex( - (r'"id"\s*:\s*(\d+)', r'data-course-id=["\'](\d+)'), - webpage, 'course id') + r'data-course-id=["\'](\d+)', webpage, 'course id') return course_id, course.get('title') def _enroll_course(self, base_url, webpage, course_id): @@ -257,6 +257,11 @@ class UdemyIE(InfoExtractor): video_url = source.get('file') or source.get('src') if not video_url or not isinstance(video_url, compat_str): continue + if source.get('type') == 'application/x-mpegURL' or determine_ext(video_url) == 'm3u8': + formats.extend(self._extract_m3u8_formats( + video_url, video_id, 'mp4', entry_protocol='m3u8_native', + m3u8_id='hls', fatal=False)) + continue format_id = source.get('label') f = { 'url': video_url, |