mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-14 09:17:20 +08:00
Merge pull request #3 from delftswa2016/r_lcp_flv
Add flash support to Arkenaplay Extractor
This commit is contained in:
commit
71eea92ed8
@ -13,10 +13,10 @@ class ArkenaPlayIE(InfoExtractor):
|
||||
|
||||
_TESTS = [{
|
||||
'url': 'http://play.lcp.fr/embed/327336/131064/darkmatter/0',
|
||||
'md5': '6cea4f7d13810464ef8485a924fc3333',
|
||||
'md5': '7d857b1af491ec0f6c2610e52df1ff82',
|
||||
'info_dict': {
|
||||
'id': '327336',
|
||||
'url': 're:http://httpod.scdn.arkena.com/11970/327336_[0-9]+.mp4',
|
||||
'url': 're:http://httpod.scdn.arkena.com/11970/327336.*',
|
||||
'ext': 'mp4',
|
||||
'title': '327336',
|
||||
'upload_date': '20160225',
|
||||
@ -40,7 +40,7 @@ class ArkenaPlayIE(InfoExtractor):
|
||||
display_id = self._search_regex(self._VALID_URL, url, 'host_name', group='id')
|
||||
webpage = self._download_webpage(url, display_id)
|
||||
|
||||
media_url_regex = '"(?P<mediainfo>(?P<host>.*)/config/avp/.*/\?callbackMethod=\?)"'
|
||||
media_url_regex = '"(?P<mediainfo>(?P<host>.*)/(c|C)onfig/.*\?callbackMethod=\?)"'
|
||||
media_url = self._html_search_regex(media_url_regex, webpage, 'arkena_media_info_url')
|
||||
hostname = self._html_search_regex(media_url_regex, webpage, 'arkena_media_host', group='host')
|
||||
if not hostname:
|
||||
@ -70,14 +70,15 @@ class ArkenaPlayIE(InfoExtractor):
|
||||
}
|
||||
|
||||
def __extract_from_playlistentry(self, arkena_playlistentry_info):
|
||||
formats = self.__get_video_formats(arkena_playlistentry_info)
|
||||
media_info = arkena_playlistentry_info.get('MediaInfo', {})
|
||||
thumbnails = self.__get_thumbnails(media_info)
|
||||
title = media_info.get('Title')
|
||||
description = media_info.get('Description')
|
||||
video_id = media_info.get('VideoId')
|
||||
timestamp = parse_iso8601(media_info.get('PublishDate'))
|
||||
formats = self.__get_video_formats(arkena_playlistentry_info, video_id)
|
||||
return {
|
||||
'id': arkena_playlistentry_info.get('EntryName'),
|
||||
'id': video_id,
|
||||
'title': title,
|
||||
'formats': formats,
|
||||
'thumbnails': thumbnails,
|
||||
@ -100,14 +101,16 @@ class ArkenaPlayIE(InfoExtractor):
|
||||
})
|
||||
return thumbnails
|
||||
|
||||
def __get_video_formats(self, media_files_info):
|
||||
def __get_video_formats(self, media_files_info, video_id):
|
||||
formats = []
|
||||
media_files = media_files_info.get('MediaFiles')
|
||||
if not media_files:
|
||||
return None
|
||||
|
||||
formats.extend(self.__get_mp4_video_formats(media_files))
|
||||
# TODO <Other video formats>
|
||||
formats.extend(self.__get_m3u8_video_formats(media_files, video_id))
|
||||
formats.extend(self.__get_flash_video_formats(media_files, video_id))
|
||||
# TODO <DASH (mpd) formats>
|
||||
self._sort_formats(formats)
|
||||
return formats
|
||||
|
||||
@ -127,3 +130,34 @@ class ArkenaPlayIE(InfoExtractor):
|
||||
'tbr': bitrate
|
||||
})
|
||||
return formats
|
||||
|
||||
def __get_m3u8_video_formats(self, media_files_json, video_id):
|
||||
formats = []
|
||||
m3u8_files_json = media_files_json.get('M3u8')
|
||||
if not m3u8_files_json:
|
||||
return None
|
||||
for video_info in m3u8_files_json:
|
||||
video_url = video_info.get('Url')
|
||||
if not video_url:
|
||||
continue
|
||||
formats.extend(self._extract_m3u8_formats(video_url, video_id, 'mp4', m3u8_id='hls', fatal=False))
|
||||
return formats
|
||||
|
||||
def __get_flash_video_formats(self, media_files_json, video_id):
|
||||
formats = []
|
||||
flash_files_json = media_files_json.get('Flash')
|
||||
if not flash_files_json:
|
||||
return None
|
||||
for video_info in flash_files_json:
|
||||
video_url = video_info.get('Url')
|
||||
if not video_url:
|
||||
continue
|
||||
video_type = video_info.get('Type')
|
||||
if video_type == 'application/hds+xml':
|
||||
formats.extend(self._extract_f4m_formats(video_url, video_id, f4m_id='hds', fatal=False))
|
||||
elif video_type == 'video/x-flv':
|
||||
formats.append({
|
||||
'url': video_url,
|
||||
'ext': 'flv'
|
||||
})
|
||||
return formats
|
||||
|
@ -8,26 +8,15 @@ class LcpIE(InfoExtractor):
|
||||
|
||||
_TESTS = [{
|
||||
'url': 'http://www.lcp.fr/la-politique-en-video/schwartzenberg-prg-preconise-francois-hollande-de-participer-une-primaire',
|
||||
'md5': 'aecf5a330cfc1061445a9af5b2df392d',
|
||||
'md5': 'ab96c4dae94322ece1e98d97c8dc7807',
|
||||
'info_dict': {
|
||||
'id': 'd56d03e9',
|
||||
'url': 're:http://httpod.scdn.arkena.com/11970/d56d03e9_[0-9]+.mp4',
|
||||
'url': 're:http://httpod.scdn.arkena.com/11970/d56d03e9_.*',
|
||||
'ext': 'mp4',
|
||||
'title': 'd56d03e9',
|
||||
'upload_date': '20160226',
|
||||
'timestamp': 1456488895
|
||||
}
|
||||
}, {
|
||||
'url': 'http://www.lcp.fr/emissions/parlementair',
|
||||
'md5': '9b63769445cbe5f26952bef71f281e8c',
|
||||
'info_dict': {
|
||||
'id': '327499',
|
||||
'url': 're:http://httpod.scdn.arkena.com/11970/327499_[0-9]+.mp4',
|
||||
'ext': 'mp4',
|
||||
'title': '327499',
|
||||
'upload_date': '20160304',
|
||||
'timestamp': 1457098658
|
||||
}
|
||||
}, {
|
||||
'url': 'http://www.lcp.fr/le-direct',
|
||||
'info_dict': {
|
||||
|
Loading…
x
Reference in New Issue
Block a user