Compare commits

..

No commits in common. "681dc6efd57556e35f5764891e52ce597d2110a0" and "06ab80ac5eabd02dbebee073c3a2bf424fbe7692" have entirely different histories.

View File

@ -5,6 +5,7 @@ from ..utils import (
extract_attributes,
get_element_by_attribute,
get_element_by_class,
get_element_by_id,
get_element_html_by_class,
get_elements_by_class,
int_or_none,
@ -12,9 +13,7 @@ from ..utils import (
parse_duration,
remove_end,
str_to_int,
traverse_obj,
unescapeHTML,
url_or_none,
)
from .common import InfoExtractor
@ -32,16 +31,14 @@ class Rule34VideoIE(InfoExtractor):
'thumbnail': 'https://rule34video.com/contents/videos_screenshots/3065000/3065157/preview.jpg',
'duration': 347.0,
'age_limit': 18,
'view_count': int,
'like_count': int,
'comment_count': int,
'timestamp': 1639872000,
'description': 'https://discord.gg/aBqPrHSHvv',
'upload_date': '20211219',
'creator': None,
'uploader': 'Sweet HMV',
'uploader_url': 'https://rule34video.com/members/22119/',
'categories': ['3D', 'MMD', 'iwara'],
'tags': 'mincount:10'
'tags': 'count:14'
}
},
{
@ -54,17 +51,14 @@ class Rule34VideoIE(InfoExtractor):
'thumbnail': 'https://rule34video.com/contents/videos_screenshots/3065000/3065296/preview.jpg',
'duration': 938.0,
'age_limit': 18,
'view_count': int,
'like_count': int,
'comment_count': int,
'timestamp': 1640131200,
'description': '',
'description': None,
'creator': 'WildeerStudio',
'upload_date': '20211222',
'uploader': 'CerZule',
'uploader_url': 'https://rule34video.com/members/36281/',
'categories': ['3D', 'Tomb Raider'],
'tags': 'mincount:40'
'tags': 'count:50'
}
},
]
@ -83,18 +77,21 @@ class Rule34VideoIE(InfoExtractor):
'quality': quality,
})
json_ld = self._search_json_ld(webpage, video_id, default={})
title = self._html_extract_title(webpage) or json_ld.get('title')
thumbnail = (self._html_search_regex(r'preview_url:\s+\'([^\']+)\'', webpage, 'thumbnail', default=None)
or traverse_obj(json_ld.get('thumbnails'), (0, 'url'), expected_type=url_or_none))
duration = parse_duration(self._html_search_regex(r'"icon-clock"></i>\s+<span>((?:\d+:?)+)', webpage, 'duration', default=None)) or json_ld.get('duration')
view_count = int_or_none(self._html_search_regex(r'"icon-eye"></i>\s+<span>([ \d]+)', webpage, 'views', default='').replace(' ', '')) or json_ld.get('view_count')
like_count = str_to_int(remove_end(get_element_by_class('voters count', webpage), ' likes')) or json_ld.get('like_count')
title = self._html_extract_title(webpage)
thumbnail = self._html_search_regex(r'preview_url:\s+\'([^\']+)\'', webpage, 'thumbnail', default=None)
duration = self._html_search_regex(r'"icon-clock"></i>\s+<span>((?:\d+:?)+)', webpage, 'duration', default=None)
like_count = str_to_int(remove_end(get_element_by_class('voters count', webpage), ' likes'))
comment_count = int_or_none(self._search_regex(r'[^(]+\((\d+)\)', get_element_by_attribute(
'href', '#tab_comments', webpage), 'comment count', fatal=False))
timestamp = json_ld.get('timestamp')
description = json_ld.get('description')
description = None
video_info_element = get_element_by_id('tab_video_info', webpage)
info_labels = get_elements_by_class('label', video_info_element)
for label in info_labels:
label_clean = label.strip(' \n\t')
if label_clean.startswith('Description:'):
description = clean_html(label_clean[len('Description:'):])
break
categories = None
creator = None
@ -114,12 +111,10 @@ class Rule34VideoIE(InfoExtractor):
'formats': formats,
'title': title,
'thumbnail': thumbnail,
'duration': duration,
'duration': parse_duration(duration),
'age_limit': 18,
'view_count': view_count,
'like_count': like_count,
'comment_count': comment_count,
'timestamp': timestamp,
'description': description,
'creator': creator,
'uploader': uploader,