@@ -398,6 +398,16 @@ def parse_quality_items(quality_items):
398
398
formats = []
399
399
400
400
def add_format (format_url , height = None ):
401
+ ext = determine_ext (format_url )
402
+ if ext == 'mpd' :
403
+ formats .extend (self ._extract_mpd_formats (
404
+ format_url , video_id , mpd_id = 'dash' , fatal = False ))
405
+ return
406
+ if ext == 'm3u8' :
407
+ formats .extend (self ._extract_m3u8_formats (
408
+ format_url , video_id , 'mp4' , entry_protocol = 'm3u8_native' ,
409
+ m3u8_id = 'hls' , fatal = False ))
410
+ return
401
411
tbr = None
402
412
mobj = re .search (r'(?P<height>\d+)[pP]?_(?P<tbr>\d+)[kK]' , format_url )
403
413
if mobj :
@@ -417,16 +427,6 @@ def add_format(format_url, height=None):
417
427
r'/(\d{6}/\d{2})/' , video_url , 'upload data' , default = None )
418
428
if upload_date :
419
429
upload_date = upload_date .replace ('/' , '' )
420
- ext = determine_ext (video_url )
421
- if ext == 'mpd' :
422
- formats .extend (self ._extract_mpd_formats (
423
- video_url , video_id , mpd_id = 'dash' , fatal = False ))
424
- continue
425
- elif ext == 'm3u8' :
426
- formats .extend (self ._extract_m3u8_formats (
427
- video_url , video_id , 'mp4' , entry_protocol = 'm3u8_native' ,
428
- m3u8_id = 'hls' , fatal = False ))
429
- continue
430
430
if '/video/get_media' in video_url :
431
431
medias = self ._download_json (video_url , video_id , fatal = False )
432
432
if isinstance (medias , list ):
0 commit comments