[aenetworks] add support for movie pages

This commit is contained in:
Remita Amine 2016-06-29 16:55:17 +01:00
parent c58ed8563d
commit 70157c2c43

View file

@ -36,7 +36,7 @@ class AENetworksBaseIE(InfoExtractor):
class AENetworksIE(AENetworksBaseIE): class AENetworksIE(AENetworksBaseIE):
IE_NAME = 'aenetworks' IE_NAME = 'aenetworks'
IE_DESC = 'A+E Networks: A&E, Lifetime, History.com, FYI Network' IE_DESC = 'A+E Networks: A&E, Lifetime, History.com, FYI Network'
_VALID_URL = r'https?://(?:www\.)?(?:(?:history|aetv|mylifetime)\.com|fyi\.tv)/shows/(?P<id>[^/]+(?:/[^/]+){0,2})' _VALID_URL = r'https?://(?:www\.)?(?:(?:history|aetv|mylifetime)\.com|fyi\.tv)/(?:shows/(?P<show_path>[^/]+(?:/[^/]+){0,2})|movies/(?P<movie_display_id>[^/]+)/full-movie)'
_TESTS = [{ _TESTS = [{
'url': 'http://www.history.com/shows/mountain-men/season-1/episode-1', 'url': 'http://www.history.com/shows/mountain-men/season-1/episode-1',
'md5': '8ff93eb073449f151d6b90c0ae1ef0c7', 'md5': '8ff93eb073449f151d6b90c0ae1ef0c7',
@ -72,12 +72,17 @@ class AENetworksIE(AENetworksBaseIE):
}, { }, {
'url': 'http://www.mylifetime.com/shows/project-runway-junior/season-1/episode-6', 'url': 'http://www.mylifetime.com/shows/project-runway-junior/season-1/episode-6',
'only_matching': True 'only_matching': True
}, {
'url': 'http://www.mylifetime.com/movies/center-stage-on-pointe/full-movie',
'only_matching': True
}] }]
def _real_extract(self, url): def _real_extract(self, url):
display_id = self._match_id(url) show_path, movie_display_id = re.match(self._VALID_URL, url).groups()
display_id = show_path or movie_display_id
webpage = self._download_webpage(url, display_id) webpage = self._download_webpage(url, display_id)
url_parts = display_id.split('/') if show_path:
url_parts = show_path.split('/')
url_parts_len = len(url_parts) url_parts_len = len(url_parts)
if url_parts_len == 1: if url_parts_len == 1:
entries = [] entries = []
@ -98,7 +103,6 @@ class AENetworksIE(AENetworksBaseIE):
episode_attributes['data-videoid'])) episode_attributes['data-videoid']))
return self.playlist_result( return self.playlist_result(
entries, self._html_search_meta('aetn:SeasonId', webpage)) entries, self._html_search_meta('aetn:SeasonId', webpage))
else:
video_id = self._html_search_meta('aetn:VideoID', webpage) video_id = self._html_search_meta('aetn:VideoID', webpage)
media_url = self._search_regex( media_url = self._search_regex(
r"media_url\s*=\s*'([^']+)'", webpage, 'video url') r"media_url\s*=\s*'([^']+)'", webpage, 'video url')
@ -115,7 +119,7 @@ class AENetworksIE(AENetworksBaseIE):
class HistoryTopicIE(AENetworksBaseIE): class HistoryTopicIE(AENetworksBaseIE):
IE_NAME = 'history:topic' IE_NAME = 'history:topic'
IE_DESC = 'History.com Topic' IE_DESC = 'History.com Topic'
_VALID_URL = r'https?://(?:www\.)?history\.com/topics/(?:[^/]+/)?(?P<topic_id>[^/]+)/videos(?:/(?P<display_id>[^/?#]+))?' _VALID_URL = r'https?://(?:www\.)?history\.com/topics/(?:[^/]+/)?(?P<topic_id>[^/]+)/videos(?:/(?P<video_display_id>[^/?#]+))?'
_TESTS = [{ _TESTS = [{
'url': 'http://www.history.com/topics/valentines-day/history-of-valentines-day/videos/bet-you-didnt-know-valentines-day?m=528e394da93ae&s=undefined&f=1&free=false', 'url': 'http://www.history.com/topics/valentines-day/history-of-valentines-day/videos/bet-you-didnt-know-valentines-day?m=528e394da93ae&s=undefined&f=1&free=false',
'info_dict': { 'info_dict': {
@ -146,9 +150,9 @@ class HistoryTopicIE(AENetworksBaseIE):
}] }]
def _real_extract(self, url): def _real_extract(self, url):
topic_id, display_id = re.match(self._VALID_URL, url).groups() topic_id, video_display_id = re.match(self._VALID_URL, url).groups()
if display_id: if video_display_id:
webpage = self._download_webpage(url, display_id) webpage = self._download_webpage(url, video_display_id)
release_url, video_id = re.search(r"_videoPlayer.play\('([^']+)'\s*,\s*'[^']+'\s*,\s*'(\d+)'\)", webpage).groups() release_url, video_id = re.search(r"_videoPlayer.play\('([^']+)'\s*,\s*'[^']+'\s*,\s*'(\d+)'\)", webpage).groups()
release_url = unescapeHTML(release_url) release_url = unescapeHTML(release_url)