mirror of https://github.com/blackjack4494/yt-dlc
[CinemassacreIE] Extract all available video/audio formats
This commit is contained in:
parent
eec4d8ef96
commit
7cf4547ab6
|
@ -14,7 +14,7 @@ class CinemassacreIE(InfoExtractor):
|
||||||
{
|
{
|
||||||
'url': 'http://cinemassacre.com/2012/11/10/avgn-the-movie-trailer/',
|
'url': 'http://cinemassacre.com/2012/11/10/avgn-the-movie-trailer/',
|
||||||
'file': '19911.mp4',
|
'file': '19911.mp4',
|
||||||
'md5': '782f8504ca95a0eba8fc9177c373eec7',
|
'md5': 'fde81fbafaee331785f58cd6c0d46190',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'upload_date': '20121110',
|
'upload_date': '20121110',
|
||||||
'title': '“Angry Video Game Nerd: The Movie” – Trailer',
|
'title': '“Angry Video Game Nerd: The Movie” – Trailer',
|
||||||
|
@ -24,7 +24,7 @@ class CinemassacreIE(InfoExtractor):
|
||||||
{
|
{
|
||||||
'url': 'http://cinemassacre.com/2013/10/02/the-mummys-hand-1940',
|
'url': 'http://cinemassacre.com/2013/10/02/the-mummys-hand-1940',
|
||||||
'file': '521be8ef82b16.mp4',
|
'file': '521be8ef82b16.mp4',
|
||||||
'md5': 'dec39ee5118f8d9cc067f45f9cbe3a35',
|
'md5': 'd72f10cd39eac4215048f62ab477a511',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'upload_date': '20131002',
|
'upload_date': '20131002',
|
||||||
'title': 'The Mummy’s Hand (1940)',
|
'title': 'The Mummy’s Hand (1940)',
|
||||||
|
@ -51,28 +51,30 @@ class CinemassacreIE(InfoExtractor):
|
||||||
webpage, 'description', flags=re.DOTALL, fatal=False)
|
webpage, 'description', flags=re.DOTALL, fatal=False)
|
||||||
|
|
||||||
playerdata = self._download_webpage(playerdata_url, video_id)
|
playerdata = self._download_webpage(playerdata_url, video_id)
|
||||||
|
video_thumbnail = self._search_regex(r'image: \'(?P<thumbnail>[^\']+)\'', playerdata, 'thumbnail', fatal=False)
|
||||||
|
sd_url = self._search_regex(r'file: \'([^\']+)\', label: \'SD\'', playerdata, 'sd_file')
|
||||||
|
videolist_url = self._search_regex(r'file: \'([^\']+\.smil)\'}', playerdata, 'videolist_url')
|
||||||
|
|
||||||
sd_url = self._html_search_regex(r'file: \'([^\']+)\', label: \'SD\'', playerdata, 'sd_file')
|
videolist = self._download_webpage(videolist_url, video_id)
|
||||||
hd_url = self._html_search_regex(
|
formats = []
|
||||||
r'file: \'([^\']+)\', label: \'HD\'', playerdata, 'hd_file',
|
baseurl = sd_url[:sd_url.rfind('/')+1]
|
||||||
default=None)
|
for match in re.finditer('<video src="mp4:(?P<file>[^"]+_(?P<format_id>[^"]+)\.[^"]+)" system-bitrate="(?P<br>\d+)"(?: width="(?P<width>\d+)" height="(?P<height>\d+)")?/>', videolist):
|
||||||
video_thumbnail = self._html_search_regex(r'image: \'(?P<thumbnail>[^\']+)\'', playerdata, 'thumbnail', fatal=False)
|
format = {
|
||||||
|
'url': baseurl + match.group('file'),
|
||||||
formats = [{
|
'format_id': match.group('format_id')
|
||||||
'url': sd_url,
|
}
|
||||||
'ext': 'mp4',
|
if match.group('width'):
|
||||||
'format': 'sd',
|
format.update({
|
||||||
'format_id': 'sd',
|
'tbr': int(match.group('br')) // 1000,
|
||||||
'quality': 1,
|
'width': int(match.group('width')),
|
||||||
}]
|
'height': int(match.group('height'))
|
||||||
if hd_url:
|
|
||||||
formats.append({
|
|
||||||
'url': hd_url,
|
|
||||||
'ext': 'mp4',
|
|
||||||
'format': 'hd',
|
|
||||||
'format_id': 'hd',
|
|
||||||
'quality': 2,
|
|
||||||
})
|
})
|
||||||
|
else:
|
||||||
|
format.update({
|
||||||
|
'abr': int(match.group('br')) // 1000,
|
||||||
|
'vcodec': 'none'
|
||||||
|
})
|
||||||
|
formats.append(format)
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue