[XHamster] Extract `uploader_id` (#844)

Authored by: octotherp
This commit is contained in:
octotherp 2021-09-01 16:28:25 +03:00 committed by GitHub
parent 1461d7bef2
commit 908b56eaf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -245,6 +245,8 @@ class XHamsterIE(InfoExtractor):
else: else:
categories = None categories = None
uploader_url = url_or_none(try_get(video, lambda x: x['author']['pageURL']))
return { return {
'id': video_id, 'id': video_id,
'display_id': display_id, 'display_id': display_id,
@ -253,6 +255,8 @@ class XHamsterIE(InfoExtractor):
'timestamp': int_or_none(video.get('created')), 'timestamp': int_or_none(video.get('created')),
'uploader': try_get( 'uploader': try_get(
video, lambda x: x['author']['name'], compat_str), video, lambda x: x['author']['name'], compat_str),
'uploader_url': uploader_url,
'uploader_id': uploader_url.split('/')[-1] if uploader_url else None,
'thumbnail': video.get('thumbURL'), 'thumbnail': video.get('thumbURL'),
'duration': int_or_none(video.get('duration')), 'duration': int_or_none(video.get('duration')),
'view_count': int_or_none(video.get('views')), 'view_count': int_or_none(video.get('views')),
@ -352,6 +356,7 @@ class XHamsterIE(InfoExtractor):
'description': description, 'description': description,
'upload_date': upload_date, 'upload_date': upload_date,
'uploader': uploader, 'uploader': uploader,
'uploader_id': uploader.lower() if uploader else None,
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'duration': duration, 'duration': duration,
'view_count': view_count, 'view_count': view_count,