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
This commit is contained in:
HobbyistDev 2024-04-08 21:28:03 +08:00
parent 363f6b3029
commit 8f2567f048
1 changed files with 7 additions and 2 deletions

View File

@ -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'
})