[trilulilu] improve extraction
parent
4ccabf93db
commit
71d9fe7818
|
@ -48,14 +48,17 @@ class TriluliluIE(InfoExtractor):
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
display_id = self._match_id(url)
|
display_id = self._match_id(url)
|
||||||
media_info = self._download_json('http://m.trilulilu.ro/%s?format=json' % display_id, display_id)
|
media_info = self._download_json('http://m.trilulilu.ro/%s?format=json' % display_id, display_id)
|
||||||
|
|
||||||
|
media_class = media_info.get('class')
|
||||||
|
if media_class not in ('video', 'audio'):
|
||||||
|
raise ExtractorError('not a video or an audio')
|
||||||
|
|
||||||
user = media_info.get('user', {})
|
user = media_info.get('user', {})
|
||||||
|
|
||||||
thumbnail = media_info.get('cover_url')
|
thumbnail = media_info.get('cover_url')
|
||||||
if thumbnail:
|
if thumbnail:
|
||||||
thumbnail.format(width='1600', height='1200')
|
thumbnail.format(width='1600', height='1200')
|
||||||
|
|
||||||
media_class = media_info.get('class')
|
|
||||||
if media_class in ('video', 'audio'):
|
|
||||||
# TODO: get correct ext for audio files
|
# TODO: get correct ext for audio files
|
||||||
stream_type = media_info.get('stream_type')
|
stream_type = media_info.get('stream_type')
|
||||||
formats = [{
|
formats = [{
|
||||||
|
@ -64,14 +67,14 @@ class TriluliluIE(InfoExtractor):
|
||||||
}]
|
}]
|
||||||
if media_info.get('is_hd'):
|
if media_info.get('is_hd'):
|
||||||
formats.append({
|
formats.append({
|
||||||
|
'format_id': 'hd',
|
||||||
'url': media_info['hrefhd'],
|
'url': media_info['hrefhd'],
|
||||||
'ext': stream_type,
|
'ext': stream_type,
|
||||||
})
|
})
|
||||||
else:
|
|
||||||
raise ExtractorError('not a video or an audio')
|
|
||||||
|
|
||||||
if media_class == 'audio':
|
if media_class == 'audio':
|
||||||
formats[0]['vcodec'] = 'none'
|
formats[0]['vcodec'] = 'none'
|
||||||
|
else:
|
||||||
|
formats[0]['format_id'] = 'sd'
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': media_info['identifier'].split('|')[1],
|
'id': media_info['identifier'].split('|')[1],
|
||||||
|
|
Loading…
Reference in New Issue