Compare commits

...

16 Commits

Author SHA1 Message Date
DarkFighterLuke
a0547394a7
Merge f2a095884c into 176fc2cb00 2024-12-31 19:47:49 -08:00
dirkf
176fc2cb00 [YouTube] Avoid early crash if webpage can't be read
* see issue #33013
2024-12-31 14:51:29 +00:00
DarkFighterLuke
f2a095884c Set uploader default values to None 2022-02-27 01:41:22 +01:00
DarkFighterLuke
f124fd7f68 Apply refactoring suggested by @rautamiekka 2022-02-27 01:30:18 +01:00
DarkFighterLuke
caa0f4be1b Merge branch 'xvideos' of github.com:DarkFighterLuke/youtube-dl into xvideos 2022-02-26 16:52:09 +01:00
DarkFighterLuke
109b85c534 Fix checks on empty data
modified:   youtube_dl/extractor/xvideos.py
2022-02-26 16:51:59 +01:00
DarkFighterLuke
e048a6184b Fix checks on empty data 2022-02-26 16:50:40 +01:00
DarkFighterLuke
3aba2a7912 Add default fallback values for creator_data 2022-02-26 15:51:58 +01:00
DarkFighterLuke
2606c3108e Check whether actors_data has been found 2022-02-26 15:50:14 +01:00
DarkFighterLuke
48e5ff4bb1 Add default fallback values 2022-02-26 15:45:23 +01:00
DarkFighterLuke
fd7aaa6ae9 Rename views to view_count 2022-02-26 15:28:09 +01:00
DarkFighterLuke
81787fd733 Scrape uploader url 2022-02-26 15:16:41 +01:00
DarkFighterLuke
a4ca768169 Scrape views 2022-02-26 15:06:16 +01:00
DarkFighterLuke
16a2888b1a Scrape actors
modified:   youtube_dl/extractor/xvideos.py
2022-02-26 14:58:52 +01:00
DarkFighterLuke
b7340781df Scrape creator 2022-02-26 14:54:42 +01:00
DarkFighterLuke
80abd212b4 Scrape tags 2022-02-26 14:25:01 +01:00
2 changed files with 41 additions and 6 deletions

View File

@ -10,6 +10,8 @@ from ..utils import (
ExtractorError,
int_or_none,
parse_duration,
str_to_int,
urljoin,
)
@ -25,14 +27,21 @@ class XVideosIE(InfoExtractor):
(?P<id>[0-9]+)
'''
_TESTS = [{
'url': 'http://www.xvideos.com/video4588838/biker_takes_his_girl',
'md5': '14cea69fcb84db54293b1e971466c2e1',
'url': 'https://www.xvideos.com/video50011247/when_girls_play_-_adriana_chechik_abella_danger_-_tradimento_-_twistys',
'md5': 'aa54f96311768b3a8bfe54b8c8fda070',
'info_dict': {
'id': '4588838',
'id': '50011247',
'ext': 'mp4',
'title': 'Biker Takes his Girl',
'duration': 108,
'title': 'When Girls Play - (Adriana Chechik, Abella Danger) - Betrayal - Twistys',
'duration': 720,
'age_limit': 18,
'tags': ['lesbian', 'teen', 'hardcore', 'latina', 'rough', 'squirt', 'big-ass', 'cheater', 'twistys', 'cheat', 'ass-play', 'when-girls-play'],
'creator': 'Twistys',
'uploader': 'Twistys',
'uploader_id': 'Twistys',
'uploader_url': '/channels/twistys1',
'actors': [{'given_name': 'Adriana Chechik', 'url': 'https://www.xvideos.com/pornstars/adriana-chechik'}, {'given_name': 'Abella Danger', 'url': 'https://www.xvideos.com/pornstars/abella-danger'}],
'view_count': int,
}
}, {
'url': 'https://flashservice.xvideos.com/embedframe/4588838',
@ -137,6 +146,25 @@ class XVideosIE(InfoExtractor):
self._sort_formats(formats)
tags = self._search_regex(r'<meta name="keywords" content="xvideos,xvideos\.com, x videos,x video,porn,video,videos,(?P<tag>.+?)"', webpage, 'tags', group='tag', default='').split(',')
creator_data = re.findall(r'<a href="(?P<creator_url>.+?)" class="btn btn-default label main uploader-tag hover-name"><span class="name">(?P<creator>.+?)<', webpage)
creator = None
uploader_url = None
if creator_data != []:
uploader_url, creator = creator_data[0][0:2]
actors_data = re.findall(r'href="(?P<actor_url>/pornstars/.+?)" class="btn btn-default label profile hover-name"><span class="name">(?P<actor_name>.+?)</span>', webpage)
actors = []
if actors_data != []:
for actor_tuple in actors_data:
actors.append({
'given_name': actor_tuple[1],
'url': urljoin(url, actor_tuple[0]),
})
views = self._search_regex(r'<strong class="mobile-hide">(?P<views>.+?)<', webpage, 'views', group='views', default=None)
return {
'id': video_id,
'formats': formats,
@ -144,4 +172,11 @@ class XVideosIE(InfoExtractor):
'duration': duration,
'thumbnails': thumbnails,
'age_limit': 18,
'tags': tags,
'creator': creator,
'uploader': creator,
'uploader_id': creator,
'uploader_url': uploader_url,
'actors': actors,
'view_count': str_to_int(views),
}

View File

@ -1951,7 +1951,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
pb_context = {'html5Preference': 'HTML5_PREF_WANTS'}
player_url = self._extract_player_url(webpage)
ytcfg = self._extract_ytcfg(video_id, webpage)
ytcfg = self._extract_ytcfg(video_id, webpage or '')
sts = self._extract_signature_timestamp(video_id, player_url, ytcfg)
if sts:
pb_context['signatureTimestamp'] = sts