1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-14 05:15:37 +00:00

[tiktok] Add new info fields

This commit is contained in:
Owen D'Aprile 2021-07-26 12:19:51 -04:00
parent a803582717
commit 397224d675
No known key found for this signature in database
GPG key ID: 291B46C15C77F8C3

View file

@ -43,6 +43,7 @@ class TikTokBaseIE(InfoExtractor):
thumbnail = url_or_none(video.get('cover')) thumbnail = url_or_none(video.get('cover'))
duration = float_or_none(video.get('duration')) duration = float_or_none(video.get('duration'))
channel = try_get(data, lambda x: x['author']['uniqueId'], compat_str)
uploader = try_get(data, lambda x: x['author']['nickname'], compat_str) uploader = try_get(data, lambda x: x['author']['nickname'], compat_str)
uploader_id = try_get(data, lambda x: x['author']['id'], compat_str) uploader_id = try_get(data, lambda x: x['author']['id'], compat_str)
@ -59,12 +60,18 @@ class TikTokBaseIE(InfoExtractor):
aweme_id = data.get('id') or video_id aweme_id = data.get('id') or video_id
track = try_get(data, lambda x: x['music']['title'])
track_id = try_get(data, lambda x: x['music']['id'])
artist = try_get(data, lambda x: x['music']['authorName'])
album = try_get(data, lambda x: x['music']['album'])
return { return {
'id': aweme_id, 'id': aweme_id,
'title': uploader or aweme_id, 'title': uploader or aweme_id,
'description': description, 'description': description,
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'duration': duration, 'duration': duration,
'channel': channel,
'uploader': uploader, 'uploader': uploader,
'uploader_id': uploader_id, 'uploader_id': uploader_id,
'timestamp': timestamp, 'timestamp': timestamp,
@ -72,6 +79,10 @@ class TikTokBaseIE(InfoExtractor):
'like_count': like_count, 'like_count': like_count,
'comment_count': comment_count, 'comment_count': comment_count,
'repost_count': repost_count, 'repost_count': repost_count,
'track': track,
'track_id': track_id,
'artist': artist,
'album': album,
'formats': formats, 'formats': formats,
} }
@ -88,6 +99,7 @@ class TikTokIE(TikTokBaseIE):
'description': '#bowsette#mario#cosplay#uk#lgbt#gaming#asian#bowsettecosplay', 'description': '#bowsette#mario#cosplay#uk#lgbt#gaming#asian#bowsettecosplay',
'thumbnail': r're:^https?://.*', 'thumbnail': r're:^https?://.*',
'duration': 15, 'duration': 15,
'channel': 'zureeal',
'uploader': 'Zureeal', 'uploader': 'Zureeal',
'uploader_id': '188294915489964032', 'uploader_id': '188294915489964032',
'timestamp': 1538248586, 'timestamp': 1538248586,
@ -96,6 +108,10 @@ class TikTokIE(TikTokBaseIE):
'like_count': int, 'like_count': int,
'comment_count': int, 'comment_count': int,
'repost_count': int, 'repost_count': int,
'track': 'Joogieboy1596 FRANK SOMOHANO',
'track_id': '6576279366609668870',
'artist': 'JoogieBoy1596',
'album': 'user87329004',
} }
}] }]