1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-29 19:47:54 +01:00

Remove info extraction from json_ld

Aparat uses an invalid ld+json format in some pages, and it causes to
JSON parser errors in some URLs, so it is better to get title and
description from og instead of ld+json
This commit is contained in:
Hanif Birgani 2020-03-16 11:33:18 +03:30
parent 1ac941fd4c
commit 8b348cf9ff

View File

@ -20,11 +20,7 @@ class AparatIE(InfoExtractor):
'id': 'wP8On', 'id': 'wP8On',
'ext': 'mp4', 'ext': 'mp4',
'title': 'تیم گلکسی 11 - زومیت', 'title': 'تیم گلکسی 11 - زومیت',
'description': 'md5:096bdabcdcc4569f2b8a5e903a3b3028', 'description': 'md5:096bdabcdcc4569f2b8a5e903a3b3028'
'duration': 231,
'timestamp': 1387394859,
'upload_date': '20131218',
'view_count': int,
}, },
}, { }, {
# multiple formats # multiple formats
@ -80,14 +76,14 @@ class AparatIE(InfoExtractor):
self._sort_formats( self._sort_formats(
formats, field_preference=('height', 'width', 'tbr', 'format_id')) formats, field_preference=('height', 'width', 'tbr', 'format_id'))
info = self._search_json_ld(webpage, video_id, default={}) title = self._og_search_title(webpage)
description = self._og_search_description(webpage)
if not info.get('title'): return {
info['title'] = options['title'] 'title': title,
'description': description,
return merge_dicts(info, {
'id': video_id, 'id': video_id,
'thumbnail': url_or_none(options.get('poster')), 'thumbnail': url_or_none(options.get('poster')),
'duration': int_or_none(options.get('duration')), 'duration': int_or_none(options.get('duration')),
'formats': formats, 'formats': formats,
}) }