mirror of
https://github.com/l1ving/youtube-dl
synced 2025-02-13 03:22:52 +08:00
Update aparat.py
it was not working with the previous code.
This commit is contained in:
parent
b002bc433a
commit
858cb62e89
@ -4,7 +4,6 @@ from __future__ import unicode_literals
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
int_or_none,
|
int_or_none,
|
||||||
merge_dicts,
|
|
||||||
mimetype2ext,
|
mimetype2ext,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
)
|
)
|
||||||
@ -20,11 +19,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
|
||||||
@ -48,14 +43,12 @@ class AparatIE(InfoExtractor):
|
|||||||
|
|
||||||
options = self._parse_json(
|
options = self._parse_json(
|
||||||
self._search_regex(
|
self._search_regex(
|
||||||
r'options\s*=\s*JSON\.parse\(\s*(["\'])(?P<value>(?:(?!\1).)+)\1\s*\)',
|
r'options\s*=\s*(?P<value>.*}}})\s*;',
|
||||||
webpage, 'options', group='value'),
|
webpage, 'options', group='value'),
|
||||||
video_id)
|
video_id)
|
||||||
|
|
||||||
player = options['plugins']['sabaPlayerPlugin']
|
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for sources in player['multiSRC']:
|
for sources in options['multiSRC']:
|
||||||
for item in sources:
|
for item in sources:
|
||||||
if not isinstance(item, dict):
|
if not isinstance(item, dict):
|
||||||
continue
|
continue
|
||||||
@ -82,14 +75,11 @@ 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={})
|
return {
|
||||||
|
'title': self._og_search_title(webpage),
|
||||||
if not info.get('title'):
|
'description': self._og_search_description(webpage),
|
||||||
info['title'] = player['title']
|
|
||||||
|
|
||||||
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(player.get('duration')),
|
'duration': int_or_none(options.get('duration')),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
})
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user