1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-08-23 04:48:31 +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_element_html_by_class,
get_elements_by_class, get_elements_by_class,
int_or_none, int_or_none,
merge_dicts,
parse_count, parse_count,
parse_duration, parse_duration,
unescapeHTML, unescapeHTML,
@ -92,16 +93,17 @@ def _real_extract(self, url):
uploader = clean_html(uploader_link) uploader = clean_html(uploader_link)
uploader_url = extract_attributes(uploader_link or '').get('href') uploader_url = extract_attributes(uploader_link or '').get('href')
return { json_ld = traverse_obj(self._search_json_ld(webpage, video_id, default={}), ({
**traverse_obj(self._search_json_ld(webpage, video_id, default={}), ({ 'title': 'title',
'title': 'title', 'view_count': 'view_count',
'view_count': 'view_count', 'like_count': 'like_count',
'like_count': 'like_count', 'duration': 'duration',
'duration': 'duration', 'timestamp': 'timestamp',
'timestamp': 'timestamp', 'description': 'description',
'description': 'description', 'thumbnail': ('thumbnails', 0, 'url'),
'thumbnail': ('thumbnails', 0, 'url'), }))
})),
return merge_dicts({
'id': video_id, 'id': video_id,
'formats': formats, 'formats': formats,
'title': self._html_extract_title(webpage), 'title': self._html_extract_title(webpage),
@ -121,4 +123,4 @@ def _real_extract(self, url):
'categories': categories, 'categories': categories,
'tags': list(map(unescapeHTML, re.findall( 'tags': list(map(unescapeHTML, re.findall(
r'<a class="tag_item"[^>]+\bhref="https://rule34video\.com/tags/\d+/"[^>]*>(?P<tag>[^>]*)</a>', webpage))), r'<a class="tag_item"[^>]+\bhref="https://rule34video\.com/tags/\d+/"[^>]*>(?P<tag>[^>]*)</a>', webpage))),
} }, json_ld)