Update docs

This commit is contained in:
sigma67 2020-02-21 14:21:52 +01:00
commit 581bbdbbd4
No known key found for this signature in database
GPG key ID: 1545A01D4474BAF0
9 changed files with 234 additions and 23 deletions

View file

@ -3,21 +3,27 @@ from ytmusicapi.ytmusic import YTMusic
youtube = YTMusic()
youtube_auth = YTMusic('../headers_auth.json')
def get_playlists():
songs = youtube.get_playlists()
playlists = youtube.get_playlists()
print(playlists)
def get_foreign_playlist():
songs = youtube.get_playlist_items("PLw-VjHDlEOgs658kAHR_LAaILBXb-s6Q5")
assert (len(songs) == 200)
def get_owned_playlist():
songs = youtube_auth.get_playlist_items('PLQwVIlKxHM6oCeKLTsUx_w9CmWjHKdg68')
assert (len(songs) == 64)
def search():
results = youtube_auth.search("Oasis Wonderwall")
print(results)
#end to end test adding playlist, adding item, deleting item, deleting playlist
def end2end():
playlist = youtube_auth.create_playlist("test", "test description")
@ -31,19 +37,8 @@ def end2end():
response = youtube_auth.delete_playlist(playlist)
assert(response['command']['handlePlaylistDeletionCommand']['playlistId'] == playlist)
# youtube.add_playlist_item('PLQwVIlKxHM6p6LRH_53M7tvRXaz0eVzpa', 'y0Hhvtmv0gk')
# songs = youtube.get_playlist_items("PLw-VjHDlEOgs658kAHR_LAaILBXb-s6Q5")
# for song in songs:
# youtube.add_playlist_item('PLQwVIlKxHM6p6LRH_53M7tvRXaz0eVzpa', song['videoId'])
# songs = youtube.get_playlist_items("PLQwVIlKxHM6p6LRH_53M7tvRXaz0eVzpa")
# for song in songs:
# youtube.remove_playlist_item("PLQwVIlKxHM6p6LRH_53M7tvRXaz0eVzpa", song['removeAction'])
# id = youtube.add_playlist("test3", "test description", True)
# youtube.remove_playlist_item('PLQwVIlKxHM6rPU4UadJV7UZf9miJcK-hm', 'cilnCQMJudo')
# YTMusic.search('lione revive')
if __name__ == '__main__':
#end2end()
#search()
search()
#get_owned_playlist()
youtube_auth.get_liked_songs()