remove `url` and `ext` from the return

Instead of set it in return, the extractor will extract the fallback formats if the `formats` length is 0
pull/9646/head
HobbyistDev 2024-04-08 21:28:03 +08:00
rodzic 363f6b3029
commit 8f2567f048
1 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -55,6 +55,12 @@ class XiaoHungSuIE(InfoExtractor):
})
})
if len(formats) == 0:
formats.append({
'url': self._html_search_meta(['og:video'], webpage),
'ext': 'mp4'
})
thumbnails = []
for image_info in traverse_obj(note_info, ('imageList', ...)):
for url in traverse_obj(image_info, (('urlDefault', 'urlPre'), {url_or_none})):
@ -65,6 +71,7 @@ class XiaoHungSuIE(InfoExtractor):
'width': 'width'
})
})
return merge_dicts({
'id': display_id,
'formats': formats,
@ -76,7 +83,5 @@ class XiaoHungSuIE(InfoExtractor):
'uploader_id': ('user', 'userId'),
}), {
'title': self._html_search_meta(['og:title'], webpage),
'url': self._html_search_meta(['og:video'], webpage),
'thumbnail': self._html_search_meta(['og:image'], webpage),
'ext': 'mp4'
})