Add more attributes to ytapi.Video from API data.
Not actually used by the application at the moment, but in the interest of making this particular file a better representation of the API, this felt like an easy change that I can take advantage of later now that I have it.
This commit is contained in:
parent
dd99ddc10f
commit
8fcba8f05b
1 changed files with 5 additions and 1 deletions
|
@ -33,9 +33,13 @@ class Video:
|
|||
published = published.rstrip('Z')
|
||||
published = datetime.datetime.strptime(published, '%Y-%m-%dT%H:%M:%S')
|
||||
self.published = published.timestamp()
|
||||
self.tags = snippet['tags']
|
||||
|
||||
self.duration = isodate.parse_duration(content_details['duration']).seconds
|
||||
self.views = statistics['viewCount']
|
||||
self.views = int(statistics['viewCount'])
|
||||
self.likes = int(statistics['likeCount'])
|
||||
self.dislikes = int(statistics['dislikeCount'])
|
||||
self.comment_count = int(statistics['commentCount'])
|
||||
|
||||
thumbnails = snippet['thumbnails']
|
||||
best_thumbnail = max(thumbnails, key=lambda x: thumbnails[x]['width'] * thumbnails[x]['height'])
|
||||
|
|
Loading…
Reference in a new issue