- content_url = self._html_search_meta(
- 'contentURL', webpage, 'content URL', fatal=False)
- ext = determine_ext(content_url, 'mp4')
-
- # Might be empty for some videos.
- streams = self._html_search_regex(
- r'"qualitylevel"\s*:\s*"([^"]+)"', webpage, 'streams', default='')
-
- formats = []
- if streams:
- for stream in streams.split('|'):
- quality, url = re.search(r'\[(\w+)\](.+)', stream).groups()
- formats.append({
- '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({
- 'format_id': 'sd',
- 'url': compat_urllib_parse_unquote(stream_url),
- 'ext': ext,
- })
-