from gmusicapi import Mobileclient


def create_playlist(playlist_name, artists, email, password, max_top_tracks=2):
    api = Mobileclient()
    logged_in = api.login(email, password, Mobileclient.FROM_MAC_ADDRESS)

    if not logged_in:
        raise Exception('Could not connect')

    song_ids = []

    for artist_name in artists:
        search = api.search(artist_name)

        if len(search["artist_hits"]) == 0:
            print('{}: Does not exist in Google Music. Skipping'.format(artist_name))
        else:
            artist_id = search["artist_hits"][0]["artist"]["artistId"]
            artist = api.get_artist_info(artist_id, include_albums=False,
                                         max_top_tracks=max_top_tracks, max_rel_artist=0)

            if 'topTracks' not in artist:
                print('{}: Exists but no songs found on Google Music. Skipping'.format(artist_name))
            else:
                song_ids = song_ids + [track['nid'] for track in artist['topTracks']]
                print('{}: Found {} song(s). Will add'.format(artist_name, len(artist['topTracks'])))

    playlist_id = api.create_playlist(playlist_name)
    print('\nCreated playlist {} ({})'.format(playlist_name, playlist_id))

    api.add_songs_to_playlist(playlist_id, song_ids)
    print('Added {} songs to the playlist'.format(len(song_ids)))

    print('All done, well done. Enjoy!')

@@ -1184,18 +1184,20 @@
 laylist 
+%22
 %7B%7D
+%22
  (%7B%7D)'.f
@@ -1231,16 +1231,20 @@
 st_id))%0A
+    
 %0A    api
@@ -1351,25 +1351,24 @@
 song_ids)))%0A
-%0A
     print('A
@@ -1374,19 +1374,8 @@
 All 
-done, well 
 done
@@ -1382,11 +1382,13 @@
 . Enjoy!
+ %F0%9F%A4%98
 ')%0A

Change logs for google music