mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-26 09:11:25 +01:00
Compare commits
4 Commits
c964d7e47e
...
a0c52e4ba2
Author | SHA1 | Date | |
---|---|---|---|
|
a0c52e4ba2 | ||
|
a9f85670d0 | ||
|
ba50c89113 | ||
|
6c6eecce23 |
|
@ -9,7 +9,7 @@ from ..utils import (
|
||||||
|
|
||||||
|
|
||||||
class ChaturbateIE(InfoExtractor):
|
class ChaturbateIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:[^/]+\.)?chaturbate\.com/(?:fullvideo/?\?.*?\bb=)?(?P<id>[^/?&#]+)'
|
_VALID_URL = r'https?://(?:[^/]+\.)?chaturbate\.(?P<tld>com|eu|global)/(?:fullvideo/?\?.*?\bb=)?(?P<id>[^/?&#]+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.chaturbate.com/siswet19/',
|
'url': 'https://www.chaturbate.com/siswet19/',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
@ -29,15 +29,24 @@ class ChaturbateIE(InfoExtractor):
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://en.chaturbate.com/siswet19/',
|
'url': 'https://en.chaturbate.com/siswet19/',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'https://chaturbate.eu/siswet19/',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'https://chaturbate.eu/fullvideo/?b=caylin',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'https://chaturbate.global/siswet19/',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
_ROOM_OFFLINE = 'Room is currently offline'
|
_ROOM_OFFLINE = 'Room is currently offline'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id, tld = self._match_valid_url(url).group('id', 'tld')
|
||||||
|
|
||||||
webpage = self._download_webpage(
|
webpage = self._download_webpage(
|
||||||
f'https://chaturbate.com/{video_id}/', video_id,
|
f'https://chaturbate.{tld}/{video_id}/', video_id,
|
||||||
headers=self.geo_verification_headers())
|
headers=self.geo_verification_headers())
|
||||||
|
|
||||||
found_m3u8_urls = []
|
found_m3u8_urls = []
|
||||||
|
|
|
@ -9,8 +9,8 @@ from ..utils import (
|
||||||
get_element_html_by_class,
|
get_element_html_by_class,
|
||||||
get_elements_by_class,
|
get_elements_by_class,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
parse_count,
|
|
||||||
parse_duration,
|
parse_duration,
|
||||||
|
str_to_int,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
)
|
)
|
||||||
from ..utils.traversal import traverse_obj
|
from ..utils.traversal import traverse_obj
|
||||||
|
@ -77,20 +77,32 @@ class Rule34VideoIE(InfoExtractor):
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': url,
|
'url': url,
|
||||||
'ext': ext.lower(),
|
'ext': ext.lower(),
|
||||||
'quality': quality,
|
'height': int(quality),
|
||||||
})
|
})
|
||||||
|
|
||||||
categories, creators, uploader, uploader_url = [None] * 4
|
categories, creators, uploader, uploader_url, views, likes = [None] * 6
|
||||||
for col in get_elements_by_class('col', webpage):
|
for col in get_elements_by_class('col', webpage):
|
||||||
label = clean_html(get_element_by_class('label', col))
|
label = clean_html(get_element_by_class('label', col))
|
||||||
if label == 'Categories:':
|
if label == 'Categories':
|
||||||
categories = list(map(clean_html, get_elements_by_class('item', col)))
|
categories = list(map(clean_html, get_elements_by_class('item', col)))
|
||||||
elif label == 'Artist:':
|
elif label == 'Artist':
|
||||||
creators = list(map(clean_html, get_elements_by_class('item', col)))
|
creators = list(map(clean_html, get_elements_by_class('item', col)))
|
||||||
elif label == 'Uploaded By:':
|
elif label == 'Uploaded by':
|
||||||
uploader = clean_html(get_element_by_class('name', col))
|
uploader = clean_html(get_element_by_class('item', col))
|
||||||
uploader_url = extract_attributes(get_element_html_by_class('name', col) or '').get('href')
|
uploader_url = extract_attributes(get_element_html_by_class('item', col) or '').get('href')
|
||||||
|
|
||||||
|
views_text = self._html_search_regex(
|
||||||
|
r'custom-eye">\s+<use[^>]+></use>\s+</svg>\s+<span>([^<]+)', webpage, 'views', default='').replace(' ', '')
|
||||||
|
views = int_or_none(views_text)
|
||||||
|
if views is None:
|
||||||
|
precise_match = re.search(r'\((?P<precise_views>[^d]+)\)', views_text)
|
||||||
|
if precise_match:
|
||||||
|
views = str_to_int(precise_match['precise_views'])
|
||||||
|
|
||||||
|
likes_text = get_element_by_class('voters count', webpage)
|
||||||
|
likes_match = re.search(r'\((?P<num_likes>[^d]+)\)', likes_text)
|
||||||
|
if likes_match:
|
||||||
|
likes = str_to_int(likes_match['num_likes'])
|
||||||
return {
|
return {
|
||||||
**traverse_obj(self._search_json_ld(webpage, video_id, default={}), ({
|
**traverse_obj(self._search_json_ld(webpage, video_id, default={}), ({
|
||||||
'title': 'title',
|
'title': 'title',
|
||||||
|
@ -107,10 +119,9 @@ class Rule34VideoIE(InfoExtractor):
|
||||||
'thumbnail': self._html_search_regex(
|
'thumbnail': self._html_search_regex(
|
||||||
r'preview_url:\s+\'([^\']+)\'', webpage, 'thumbnail', default=None),
|
r'preview_url:\s+\'([^\']+)\'', webpage, 'thumbnail', default=None),
|
||||||
'duration': parse_duration(self._html_search_regex(
|
'duration': parse_duration(self._html_search_regex(
|
||||||
r'"icon-clock"></i>\s+<span>((?:\d+:?)+)', webpage, 'duration', default=None)),
|
r'custom-time">\s+<use[^>]+></use>\s+</svg>\s+<span>((?:\d+:?)+)', webpage, 'duration', default=None)),
|
||||||
'view_count': int_or_none(self._html_search_regex(
|
'view_count': views,
|
||||||
r'"icon-eye"></i>\s+<span>([ \d]+)', webpage, 'views', default='').replace(' ', '')),
|
'like_count': likes,
|
||||||
'like_count': parse_count(get_element_by_class('voters count', webpage)),
|
|
||||||
'comment_count': int_or_none(self._search_regex(
|
'comment_count': int_or_none(self._search_regex(
|
||||||
r'[^(]+\((\d+)\)', get_element_by_attribute('href', '#tab_comments', webpage), 'comment count', fatal=False)),
|
r'[^(]+\((\d+)\)', get_element_by_attribute('href', '#tab_comments', webpage), 'comment count', fatal=False)),
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user