+ for k in ('token', 'sign'):
+ v = f.get(k)
+ if v:
+ query[k] = v
+ f_url = update_url_query(f_url, query)
+ format_id = format_id
+ if format_id == 'HLS':
+ m3u8_formats = self._extract_m3u8_formats(
+ f_url, media_id, 'mp4', 'm3u8_native',
+ m3u8_id='hls', fatal=False)
+ encoded_query = compat_urllib_parse_urlencode(query)
+ for m3u8_f in m3u8_formats:
+ m3u8_f['extra_param_to_segment_url'] = encoded_query
+ m3u8_f['url'] = update_url_query(m3u8_f['url'], query)
+ formats.extend(m3u8_formats)
+ continue
+ formats.append({
+ 'format_id': format_id,
+ 'url': f_url,
+ 'quality': quality(format_id),
+ 'preference': -1,
+ })