mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-10 13:07:14 +08:00
Add missing handle and followers.
This commit is contained in:
parent
f5ac40a0a2
commit
c9ffdf7b52
@ -731,36 +731,38 @@ class TwitchClipsIE(TwitchBaseIE):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
clip = self._download_json(
|
response = self._download_json(
|
||||||
'https://gql.twitch.tv/gql', video_id, data=json.dumps({
|
'https://gql.twitch.tv/gql', video_id, data=json.dumps({
|
||||||
'query': '''{
|
'query': '''{
|
||||||
clip(slug: "%s") {
|
clip(slug: "%s") {
|
||||||
broadcaster {
|
broadcaster {
|
||||||
displayName
|
displayName
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
createdAt
|
createdAt
|
||||||
curator {
|
curator {
|
||||||
displayName
|
displayName
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
durationSeconds
|
durationSeconds
|
||||||
id
|
id
|
||||||
tiny: thumbnailURL(width: 86, height: 45)
|
tiny: thumbnailURL(width: 86, height: 45)
|
||||||
small: thumbnailURL(width: 260, height: 147)
|
small: thumbnailURL(width: 260, height: 147)
|
||||||
medium: thumbnailURL(width: 480, height: 272)
|
medium: thumbnailURL(width: 480, height: 272)
|
||||||
title
|
title
|
||||||
videoQualities {
|
videoQualities {
|
||||||
frameRate
|
frameRate
|
||||||
quality
|
quality
|
||||||
sourceURL
|
sourceURL
|
||||||
}
|
}
|
||||||
viewCount
|
viewCount
|
||||||
}
|
}
|
||||||
}''' % video_id,
|
}''' % video_id,
|
||||||
}).encode(), headers={
|
}).encode(), headers={
|
||||||
'Client-ID': self._CLIENT_ID,
|
'Client-ID': self._CLIENT_ID,
|
||||||
})['data']['clip']
|
})
|
||||||
|
|
||||||
|
clip = response['data']['clip']
|
||||||
|
|
||||||
if not clip:
|
if not clip:
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
@ -798,6 +800,13 @@ class TwitchClipsIE(TwitchBaseIE):
|
|||||||
})
|
})
|
||||||
thumbnails.append(thumb)
|
thumbnails.append(thumb)
|
||||||
|
|
||||||
|
channel_id = clip['broadcaster']['id']
|
||||||
|
channel = self._call_api(
|
||||||
|
'kraken/channels/%s' % channel_id,
|
||||||
|
channel_id, 'Downloading channel info JSON')
|
||||||
|
|
||||||
|
uploader_like_count = channel.get('followers')
|
||||||
|
creator_handle = channel.get('name')
|
||||||
return {
|
return {
|
||||||
'id': clip.get('id') or video_id,
|
'id': clip.get('id') or video_id,
|
||||||
'title': clip.get('title') or video_id,
|
'title': clip.get('title') or video_id,
|
||||||
@ -808,6 +817,9 @@ class TwitchClipsIE(TwitchBaseIE):
|
|||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
'creator': try_get(clip, lambda x: x['broadcaster']['displayName'], compat_str),
|
'creator': try_get(clip, lambda x: x['broadcaster']['displayName'], compat_str),
|
||||||
'creator_id': try_get(clip, lambda x: x['broadcaster']['id'], compat_str),
|
'creator_id': try_get(clip, lambda x: x['broadcaster']['id'], compat_str),
|
||||||
|
'creator_handle': creator_handle,
|
||||||
'uploader': try_get(clip, lambda x: x['curator']['displayName'], compat_str),
|
'uploader': try_get(clip, lambda x: x['curator']['displayName'], compat_str),
|
||||||
'uploader_id': try_get(clip, lambda x: x['curator']['id'], compat_str),
|
'uploader_id': try_get(clip, lambda x: x['curator']['id'], compat_str),
|
||||||
|
'uploader_handle': try_get(clip, lambda x: x['curator']['name'], compat_str),
|
||||||
|
'uploader_like_count': uploader_like_count
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user