1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

[animeondemand] Respect startvideo (Closes #8923)

This commit is contained in:
Sergey M․ 2016-03-21 23:31:40 +06:00
parent ff5873b72d
commit 5c69f7a479

View file

@ -163,7 +163,7 @@ class AnimeOnDemandIE(InfoExtractor):
if kind: if kind:
format_id_list.append(kind) format_id_list.append(kind)
if not format_id_list: if not format_id_list:
format_id_list.append('hls') format_id_list.append(compat_str(num))
format_id = '-'.join(format_id_list) format_id = '-'.join(format_id_list)
format_note = ', '.join(filter(None, (kind, lang_note))) format_note = ', '.join(filter(None, (kind, lang_note)))
request = sanitized_Request( request = sanitized_Request(
@ -179,26 +179,41 @@ class AnimeOnDemandIE(InfoExtractor):
fatal=False) fatal=False)
if not playlist: if not playlist:
continue continue
start_video = playlist.get('startvideo', 0)
playlist = playlist.get('playlist') playlist = playlist.get('playlist')
if not playlist or not isinstance(playlist, list): if not playlist or not isinstance(playlist, list):
continue continue
playlist = playlist[0] playlist = playlist[start_video]
title = playlist.get('title') title = playlist.get('title')
if not title: if not title:
continue continue
description = playlist.get('description') description = playlist.get('description')
for source in playlist.get('sources', []): for source in playlist.get('sources', []):
file_ = source.get('file') file_ = source.get('file')
if file_ and determine_ext(file_) == 'm3u8': if not file_:
m3u8_formats = self._extract_m3u8_formats( continue
ext = determine_ext(file_)
format_id_list = [lang, kind]
if ext == 'm3u8':
format_id_list.append('hls')
elif source.get('type') == 'video/dash' or ext == 'mpd':
format_id_list.append('dash')
format_id = '-'.join(filter(None, format_id_list))
if ext == 'm3u8':
file_formats = self._extract_m3u8_formats(
file_, video_id, 'mp4', file_, video_id, 'mp4',
entry_protocol='m3u8_native', m3u8_id=format_id) entry_protocol='m3u8_native', m3u8_id=format_id, fatal=False)
for f in m3u8_formats: elif source.get('type') == 'video/dash' or ext == 'mpd':
f.update({ file_formats = self._extract_mpd_formats(
'language': lang, file_, video_id, mpd_id=format_id, fatal=False)
'format_note': format_note, else:
}) continue
formats.extend(m3u8_formats) for f in file_formats:
f.update({
'language': lang,
'format_note': format_note,
})
formats.extend(file_formats)
if formats: if formats:
self._sort_formats(formats) self._sort_formats(formats)