mirror of https://github.com/yt-dlp/yt-dlp.git
parent
8130779db6
commit
99d6f9461d
|
@ -33,19 +33,22 @@ class AparatIE(InfoExtractor):
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
def _parse_options(self, webpage, video_id, fatal=True):
|
||||||
|
return self._parse_json(self._search_regex(
|
||||||
|
r'options\s*=\s*({.+?})\s*;', webpage, 'options', default='{}'), video_id)
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
# Provides more metadata
|
# If available, provides more metadata
|
||||||
webpage = self._download_webpage(url, video_id, fatal=False)
|
webpage = self._download_webpage(url, video_id, fatal=False)
|
||||||
|
options = self._parse_options(webpage, video_id, fatal=False)
|
||||||
|
|
||||||
if not webpage:
|
if not options:
|
||||||
webpage = self._download_webpage(
|
webpage = self._download_webpage(
|
||||||
'http://www.aparat.com/video/video/embed/vt/frame/showvideo/yes/videohash/' + video_id,
|
'http://www.aparat.com/video/video/embed/vt/frame/showvideo/yes/videohash/' + video_id,
|
||||||
video_id)
|
video_id, 'Downloading embed webpage')
|
||||||
|
options = self._parse_options(webpage, video_id)
|
||||||
options = self._parse_json(self._search_regex(
|
|
||||||
r'options\s*=\s*({.+?})\s*;', webpage, 'options'), video_id)
|
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for sources in (options.get('multiSRC') or []):
|
for sources in (options.get('multiSRC') or []):
|
||||||
|
|
Loading…
Reference in New Issue