def scrape_albums(artist, cursor): res = [] count = 0 artist_name = artist.get_song_page_name() for album in artist.get_album_infos(): album = Album(artist.artist_name, album) res.append(album) print(f'{album.title} [{len(album.songs)}]') for song_name in album.songs: count = count + 1 if _song_exists(song_name, artist_name, cursor): print(f' ↛ {song_name} [skip]') else: song = Song(artist_name, song_name) _insert_song(song, album, cursor) return res, count