Added category to get_song() results.

This commit is contained in:
Daniel Marai 2020-11-30 17:35:00 +01:00
commit 1fb0968760

View file

@ -508,6 +508,7 @@ class BrowsingMixin:
"Producer: Owen Morris & Noel Gallagher" "Producer: Owen Morris & Noel Gallagher"
], ],
"release": "2014-09-29" "release": "2014-09-29"
"category": "Music"
} }
""" """
@ -519,6 +520,7 @@ class BrowsingMixin:
return text return text
player_response = json.loads(text['player_response'][0]) player_response = json.loads(text['player_response'][0])
song_meta = player_response['videoDetails'] song_meta = player_response['videoDetails']
song_meta['category'] = player_response['microformat']['playerMicroformatRenderer']['category']
if song_meta['shortDescription'].endswith("Auto-generated by YouTube."): if song_meta['shortDescription'].endswith("Auto-generated by YouTube."):
try: try:
description = song_meta['shortDescription'].split('\n\n') description = song_meta['shortDescription'].split('\n\n')