1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-08-18 10:28:29 +00:00

[ie/rule34video] Properly fall back to JSON-LD info

This commit is contained in:
gmes78 2025-06-27 10:42:20 +01:00
parent 7b336d1e73
commit f44a01bf67

View File

@ -9,6 +9,7 @@
get_element_html_by_class,
get_elements_by_class,
int_or_none,
merge_dicts,
parse_count,
parse_duration,
unescapeHTML,
@ -92,16 +93,17 @@ def _real_extract(self, url):
uploader = clean_html(uploader_link)
uploader_url = extract_attributes(uploader_link or '').get('href')
return {
**traverse_obj(self._search_json_ld(webpage, video_id, default={}), ({
'title': 'title',
'view_count': 'view_count',
'like_count': 'like_count',
'duration': 'duration',
'timestamp': 'timestamp',
'description': 'description',
'thumbnail': ('thumbnails', 0, 'url'),
})),
json_ld = traverse_obj(self._search_json_ld(webpage, video_id, default={}), ({
'title': 'title',
'view_count': 'view_count',
'like_count': 'like_count',
'duration': 'duration',
'timestamp': 'timestamp',
'description': 'description',
'thumbnail': ('thumbnails', 0, 'url'),
}))
return merge_dicts({
'id': video_id,
'formats': formats,
'title': self._html_extract_title(webpage),
@ -121,4 +123,4 @@ def _real_extract(self, url):
'categories': categories,
'tags': list(map(unescapeHTML, re.findall(
r'<a class="tag_item"[^>]+\bhref="https://rule34video\.com/tags/\d+/"[^>]*>(?P<tag>[^>]*)</a>', webpage))),
}
}, json_ld)