mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-16 12:21:25 +01:00
Compare commits
6 Commits
06ab80ac5e
...
681dc6efd5
Author | SHA1 | Date | |
---|---|---|---|
|
681dc6efd5 | ||
|
343520ad9f | ||
|
13ae53ac08 | ||
|
640b9ecb4e | ||
|
2dec50c414 | ||
|
467b22034f |
|
@ -5,7 +5,6 @@ from ..utils import (
|
||||||
extract_attributes,
|
extract_attributes,
|
||||||
get_element_by_attribute,
|
get_element_by_attribute,
|
||||||
get_element_by_class,
|
get_element_by_class,
|
||||||
get_element_by_id,
|
|
||||||
get_element_html_by_class,
|
get_element_html_by_class,
|
||||||
get_elements_by_class,
|
get_elements_by_class,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
@ -13,7 +12,9 @@ from ..utils import (
|
||||||
parse_duration,
|
parse_duration,
|
||||||
remove_end,
|
remove_end,
|
||||||
str_to_int,
|
str_to_int,
|
||||||
|
traverse_obj,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
|
url_or_none,
|
||||||
)
|
)
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
@ -31,14 +32,16 @@ class Rule34VideoIE(InfoExtractor):
|
||||||
'thumbnail': 'https://rule34video.com/contents/videos_screenshots/3065000/3065157/preview.jpg',
|
'thumbnail': 'https://rule34video.com/contents/videos_screenshots/3065000/3065157/preview.jpg',
|
||||||
'duration': 347.0,
|
'duration': 347.0,
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
|
'view_count': int,
|
||||||
'like_count': int,
|
'like_count': int,
|
||||||
'comment_count': int,
|
'comment_count': int,
|
||||||
|
'timestamp': 1639872000,
|
||||||
'description': 'https://discord.gg/aBqPrHSHvv',
|
'description': 'https://discord.gg/aBqPrHSHvv',
|
||||||
'creator': None,
|
'upload_date': '20211219',
|
||||||
'uploader': 'Sweet HMV',
|
'uploader': 'Sweet HMV',
|
||||||
'uploader_url': 'https://rule34video.com/members/22119/',
|
'uploader_url': 'https://rule34video.com/members/22119/',
|
||||||
'categories': ['3D', 'MMD', 'iwara'],
|
'categories': ['3D', 'MMD', 'iwara'],
|
||||||
'tags': 'count:14'
|
'tags': 'mincount:10'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -51,14 +54,17 @@ class Rule34VideoIE(InfoExtractor):
|
||||||
'thumbnail': 'https://rule34video.com/contents/videos_screenshots/3065000/3065296/preview.jpg',
|
'thumbnail': 'https://rule34video.com/contents/videos_screenshots/3065000/3065296/preview.jpg',
|
||||||
'duration': 938.0,
|
'duration': 938.0,
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
|
'view_count': int,
|
||||||
'like_count': int,
|
'like_count': int,
|
||||||
'comment_count': int,
|
'comment_count': int,
|
||||||
'description': None,
|
'timestamp': 1640131200,
|
||||||
|
'description': '',
|
||||||
'creator': 'WildeerStudio',
|
'creator': 'WildeerStudio',
|
||||||
|
'upload_date': '20211222',
|
||||||
'uploader': 'CerZule',
|
'uploader': 'CerZule',
|
||||||
'uploader_url': 'https://rule34video.com/members/36281/',
|
'uploader_url': 'https://rule34video.com/members/36281/',
|
||||||
'categories': ['3D', 'Tomb Raider'],
|
'categories': ['3D', 'Tomb Raider'],
|
||||||
'tags': 'count:50'
|
'tags': 'mincount:40'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -77,21 +83,18 @@ class Rule34VideoIE(InfoExtractor):
|
||||||
'quality': quality,
|
'quality': quality,
|
||||||
})
|
})
|
||||||
|
|
||||||
title = self._html_extract_title(webpage)
|
json_ld = self._search_json_ld(webpage, video_id, default={})
|
||||||
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)
|
title = self._html_extract_title(webpage) or json_ld.get('title')
|
||||||
like_count = str_to_int(remove_end(get_element_by_class('voters count', webpage), ' likes'))
|
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')
|
||||||
comment_count = int_or_none(self._search_regex(r'[^(]+\((\d+)\)', get_element_by_attribute(
|
comment_count = int_or_none(self._search_regex(r'[^(]+\((\d+)\)', get_element_by_attribute(
|
||||||
'href', '#tab_comments', webpage), 'comment count', fatal=False))
|
'href', '#tab_comments', webpage), 'comment count', fatal=False))
|
||||||
|
timestamp = json_ld.get('timestamp')
|
||||||
description = None
|
description = json_ld.get('description')
|
||||||
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
|
categories = None
|
||||||
creator = None
|
creator = None
|
||||||
|
@ -111,10 +114,12 @@ class Rule34VideoIE(InfoExtractor):
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'title': title,
|
'title': title,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'duration': parse_duration(duration),
|
'duration': duration,
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
|
'view_count': view_count,
|
||||||
'like_count': like_count,
|
'like_count': like_count,
|
||||||
'comment_count': comment_count,
|
'comment_count': comment_count,
|
||||||
|
'timestamp': timestamp,
|
||||||
'description': description,
|
'description': description,
|
||||||
'creator': creator,
|
'creator': creator,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user