Added tests for get_lyrics

This commit is contained in:
alexmercerind 2020-12-04 18:33:23 +05:30
commit 0d81ec9dcd
2 changed files with 12 additions and 0 deletions

View file

@ -92,6 +92,17 @@ class TestYTMusic(unittest.TestCase):
streaming_data = youtube_auth.get_streaming_data("ZrOKjDZOtkA") streaming_data = youtube_auth.get_streaming_data("ZrOKjDZOtkA")
self.assertEqual(len(streaming_data), 3) self.assertEqual(len(streaming_data), 3)
def test_get_lyrics(self):
lyrics_song = youtube.get_lyrics("ZrOKjDZOtkA")
self.assertIsNotNone(lyrics_song["browseId"])
self.assertIsNotNone(lyrics_song["lyrics"])
self.assertIsNotNone(lyrics_song["source"])
no_lyrics_song = youtube.get_lyrics("9TnpB8WgW4s")
self.assertIsNotNone(no_lyrics_song["browseId"])
self.assertIsNotNone(no_lyrics_song["lyrics"])
self.assertIsNotNone(no_lyrics_song["source"])
############### ###############
# WATCH # WATCH
############### ###############

View file

@ -658,6 +658,7 @@ class BrowsingMixin:
'videoId': videoId, 'videoId': videoId,
'browseId': None, 'browseId': None,
'lyrics': None, 'lyrics': None,
'source': None,
} }
browseIdResponse = self._send_request('next', body) browseIdResponse = self._send_request('next', body)
for tab in browseIdResponse['contents']['singleColumnMusicWatchNextResultsRenderer']['tabbedRenderer']['watchNextTabbedResultsRenderer']['tabs']: for tab in browseIdResponse['contents']['singleColumnMusicWatchNextResultsRenderer']['tabbedRenderer']['watchNextTabbedResultsRenderer']['tabs']: