mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-06 01:22:35 +00:00
[izlesene] Fix extraction (closes #16233)
This commit is contained in:
parent
aee36ca832
commit
f4d261b765
@ -1,8 +1,6 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import compat_urllib_parse_unquote
|
from ..compat import compat_urllib_parse_unquote
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
@ -72,7 +70,7 @@ class IzleseneIE(InfoExtractor):
|
|||||||
'uploadDate', webpage, 'upload date'))
|
'uploadDate', webpage, 'upload date'))
|
||||||
|
|
||||||
duration = float_or_none(self._html_search_regex(
|
duration = float_or_none(self._html_search_regex(
|
||||||
r'"videoduration"\s*:\s*"([^"]+)"',
|
r'videoduration\s*=\s*\'([^\']+)\'',
|
||||||
webpage, 'duration', fatal=False), scale=1000)
|
webpage, 'duration', fatal=False), scale=1000)
|
||||||
|
|
||||||
view_count = str_to_int(get_element_by_id('videoViewCount', webpage))
|
view_count = str_to_int(get_element_by_id('videoViewCount', webpage))
|
||||||
@ -80,29 +78,18 @@ class IzleseneIE(InfoExtractor):
|
|||||||
r'comment_count\s*=\s*\'([^\']+)\';',
|
r'comment_count\s*=\s*\'([^\']+)\';',
|
||||||
webpage, 'comment_count', fatal=False)
|
webpage, 'comment_count', fatal=False)
|
||||||
|
|
||||||
content_url = self._html_search_meta(
|
streams_json = self._html_search_regex(
|
||||||
'contentURL', webpage, 'content URL', fatal=False)
|
r'_videoObj\s*=\s*(.+);', webpage, 'streams')
|
||||||
ext = determine_ext(content_url, 'mp4')
|
streams = self._parse_json(streams_json, video_id)
|
||||||
|
|
||||||
# Might be empty for some videos.
|
|
||||||
streams = self._html_search_regex(
|
|
||||||
r'"qualitylevel"\s*:\s*"([^"]+)"', webpage, 'streams', default='')
|
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
if streams:
|
for stream in streams.get('media').get('level'):
|
||||||
for stream in streams.split('|'):
|
url = stream.get('source')
|
||||||
quality, url = re.search(r'\[(\w+)\](.+)', stream).groups()
|
ext = determine_ext(url, 'mp4')
|
||||||
formats.append({
|
quality = stream.get('value')
|
||||||
'format_id': '%sp' % quality if quality else 'sd',
|
|
||||||
'url': compat_urllib_parse_unquote(url),
|
|
||||||
'ext': ext,
|
|
||||||
})
|
|
||||||
else:
|
|
||||||
stream_url = self._search_regex(
|
|
||||||
r'"streamurl"\s*:\s*"([^"]+)"', webpage, 'stream URL')
|
|
||||||
formats.append({
|
formats.append({
|
||||||
'format_id': 'sd',
|
'format_id': '%sp' % quality,
|
||||||
'url': compat_urllib_parse_unquote(stream_url),
|
'url': compat_urllib_parse_unquote(url),
|
||||||
'ext': ext,
|
'ext': ext,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user