diff options
Diffstat (limited to 'youtube_dl/extractor/dailymotion.py')
-rw-r--r-- | youtube_dl/extractor/dailymotion.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/youtube_dl/extractor/dailymotion.py b/youtube_dl/extractor/dailymotion.py index 10b97d8ca..bae1c7754 100644 --- a/youtube_dl/extractor/dailymotion.py +++ b/youtube_dl/extractor/dailymotion.py @@ -8,7 +8,6 @@ from .subtitles import SubtitlesInfoExtractor from ..utils import ( compat_urllib_request, compat_str, - get_element_by_attribute, get_element_by_id, orderedSet, str_to_int, @@ -180,7 +179,7 @@ class DailymotionIE(DailymotionBaseInfoExtractor, SubtitlesInfoExtractor): class DailymotionPlaylistIE(DailymotionBaseInfoExtractor): IE_NAME = u'dailymotion:playlist' _VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/playlist/(?P<id>.+?)/' - _MORE_PAGES_INDICATOR = r'<div class="next">.*?<a.*?href="/playlist/.+?".*?>.*?</a>.*?</div>' + _MORE_PAGES_INDICATOR = r'(?s)<div class="pages[^"]*">.*?<a\s+class="[^"]*?icon-arrow_right[^"]*?"' _PAGE_TEMPLATE = 'https://www.dailymotion.com/playlist/%s/%s' def _extract_entries(self, id): @@ -190,10 +189,9 @@ class DailymotionPlaylistIE(DailymotionBaseInfoExtractor): webpage = self._download_webpage(request, id, u'Downloading page %s' % pagenum) - playlist_el = get_element_by_attribute(u'class', u'row video_list', webpage) - video_ids.extend(re.findall(r'data-id="(.+?)"', playlist_el)) + video_ids.extend(re.findall(r'data-id="(.+?)"', webpage)) - if re.search(self._MORE_PAGES_INDICATOR, webpage, re.DOTALL) is None: + if re.search(self._MORE_PAGES_INDICATOR, webpage) is None: break return [self.url_result('http://www.dailymotion.com/video/%s' % video_id, 'Dailymotion') for video_id in orderedSet(video_ids)] @@ -203,17 +201,17 @@ class DailymotionPlaylistIE(DailymotionBaseInfoExtractor): playlist_id = mobj.group('id') webpage = self._download_webpage(url, playlist_id) - return {'_type': 'playlist', - 'id': playlist_id, - 'title': get_element_by_id(u'playlist_name', webpage), - 'entries': self._extract_entries(playlist_id), - } + return { + '_type': 'playlist', + 'id': playlist_id, + 'title': self._og_search_title(webpage), + 'entries': self._extract_entries(playlist_id), + } class DailymotionUserIE(DailymotionPlaylistIE): IE_NAME = u'dailymotion:user' - _VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/user/(?P<user>[^/]+)' - _MORE_PAGES_INDICATOR = r'<div class="next">.*?<a.*?href="/user/.+?".*?>.*?</a>.*?</div>' + _VALID_URL = r'https?://(?:www\.)?dailymotion\.[a-z]{2,3}/user/(?P<user>[^/]+)' _PAGE_TEMPLATE = 'http://www.dailymotion.com/user/%s/%s' def _real_extract(self, url): |