|
|
@ -36,7 +36,7 @@ class AENetworksBaseIE(InfoExtractor): |
|
|
|
class AENetworksIE(AENetworksBaseIE): |
|
|
|
IE_NAME = 'aenetworks' |
|
|
|
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 = [{ |
|
|
|
'url': 'http://www.history.com/shows/mountain-men/season-1/episode-1', |
|
|
|
'md5': '8ff93eb073449f151d6b90c0ae1ef0c7', |
|
|
@ -72,50 +72,54 @@ class AENetworksIE(AENetworksBaseIE): |
|
|
|
}, { |
|
|
|
'url': 'http://www.mylifetime.com/shows/project-runway-junior/season-1/episode-6', |
|
|
|
'only_matching': True |
|
|
|
}, { |
|
|
|
'url': 'http://www.mylifetime.com/movies/center-stage-on-pointe/full-movie', |
|
|
|
'only_matching': True |
|
|
|
}] |
|
|
|
|
|
|
|
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) |
|
|
|
url_parts = display_id.split('/') |
|
|
|
url_parts_len = len(url_parts) |
|
|
|
if url_parts_len == 1: |
|
|
|
entries = [] |
|
|
|
for season_url_path in re.findall(r'(?s)<li[^>]+data-href="(/shows/%s/season-\d+)"' % url_parts[0], webpage): |
|
|
|
entries.append(self.url_result( |
|
|
|
compat_urlparse.urljoin(url, season_url_path), 'AENetworks')) |
|
|
|
return self.playlist_result( |
|
|
|
entries, self._html_search_meta('aetn:SeriesId', webpage), |
|
|
|
self._html_search_meta('aetn:SeriesTitle', webpage)) |
|
|
|
elif url_parts_len == 2: |
|
|
|
entries = [] |
|
|
|
for episode_item in re.findall(r'(?s)<div[^>]+class="[^"]*episode-item[^"]*"[^>]*>', webpage): |
|
|
|
episode_attributes = extract_attributes(episode_item) |
|
|
|
episode_url = compat_urlparse.urljoin( |
|
|
|
url, episode_attributes['data-canonical']) |
|
|
|
entries.append(self.url_result( |
|
|
|
episode_url, 'AENetworks', |
|
|
|
episode_attributes['data-videoid'])) |
|
|
|
return self.playlist_result( |
|
|
|
entries, self._html_search_meta('aetn:SeasonId', webpage)) |
|
|
|
else: |
|
|
|
video_id = self._html_search_meta('aetn:VideoID', webpage) |
|
|
|
media_url = self._search_regex( |
|
|
|
r"media_url\s*=\s*'([^']+)'", webpage, 'video url') |
|
|
|
if show_path: |
|
|
|
url_parts = show_path.split('/') |
|
|
|
url_parts_len = len(url_parts) |
|
|
|
if url_parts_len == 1: |
|
|
|
entries = [] |
|
|
|
for season_url_path in re.findall(r'(?s)<li[^>]+data-href="(/shows/%s/season-\d+)"' % url_parts[0], webpage): |
|
|
|
entries.append(self.url_result( |
|
|
|
compat_urlparse.urljoin(url, season_url_path), 'AENetworks')) |
|
|
|
return self.playlist_result( |
|
|
|
entries, self._html_search_meta('aetn:SeriesId', webpage), |
|
|
|
self._html_search_meta('aetn:SeriesTitle', webpage)) |
|
|
|
elif url_parts_len == 2: |
|
|
|
entries = [] |
|
|
|
for episode_item in re.findall(r'(?s)<div[^>]+class="[^"]*episode-item[^"]*"[^>]*>', webpage): |
|
|
|
episode_attributes = extract_attributes(episode_item) |
|
|
|
episode_url = compat_urlparse.urljoin( |
|
|
|
url, episode_attributes['data-canonical']) |
|
|
|
entries.append(self.url_result( |
|
|
|
episode_url, 'AENetworks', |
|
|
|
episode_attributes['data-videoid'])) |
|
|
|
return self.playlist_result( |
|
|
|
entries, self._html_search_meta('aetn:SeasonId', webpage)) |
|
|
|
video_id = self._html_search_meta('aetn:VideoID', webpage) |
|
|
|
media_url = self._search_regex( |
|
|
|
r"media_url\s*=\s*'([^']+)'", webpage, 'video url') |
|
|
|
|
|
|
|
info = self._search_json_ld(webpage, video_id, fatal=False) |
|
|
|
info.update(self.theplatform_url_result( |
|
|
|
media_url, video_id, { |
|
|
|
'mbr': 'true', |
|
|
|
'assetTypes': 'medium_video_s3' |
|
|
|
})) |
|
|
|
return info |
|
|
|
info = self._search_json_ld(webpage, video_id, fatal=False) |
|
|
|
info.update(self.theplatform_url_result( |
|
|
|
media_url, video_id, { |
|
|
|
'mbr': 'true', |
|
|
|
'assetTypes': 'medium_video_s3' |
|
|
|
})) |
|
|
|
return info |
|
|
|
|
|
|
|
|
|
|
|
class HistoryTopicIE(AENetworksBaseIE): |
|
|
|
IE_NAME = 'history: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 = [{ |
|
|
|
'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': { |
|
|
@ -146,9 +150,9 @@ class HistoryTopicIE(AENetworksBaseIE): |
|
|
|
}] |
|
|
|
|
|
|
|
def _real_extract(self, url): |
|
|
|
topic_id, display_id = re.match(self._VALID_URL, url).groups() |
|
|
|
if display_id: |
|
|
|
webpage = self._download_webpage(url, display_id) |
|
|
|
topic_id, video_display_id = re.match(self._VALID_URL, url).groups() |
|
|
|
if video_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 = unescapeHTML(release_url) |
|
|
|
|
|
|
|