Skip to content

Instantly share code, notes, and snippets.

@sandorkazi sandorkazi/artist2.py
Last active Mar 18, 2019

Embed
What would you like to do?
Spotify get
with open('spotify_a_s.txt') as f:
songs = list(map(str.strip, f))
with open('spotify_a.txt') as f:
artists = list(map(str.strip, f))
def song_parser(songs, last_song=None, counter=0):
if songs == []:
if counter != 2:
yield (last_song, counter)
return
head, *tail = songs
head = set(head.split(', '))
if last_song is not None and last_song & head:
yield from song_parser(tail, last_song & head, counter+1)
else:
if counter != 2:
yield (last_song, counter)
yield from song_parser(tail, head, 1)
with open('spotify_not2.txt') as f:
for a in song_parser(songs):
f.write('{}\t{}'.format(a[1], a[0]))
f.write('\n')
for a in artists:
for s in songs:
s = s.split(', ')
if a in s:
break
else:
print(a)
var newWindow = window.open("");
var body = newWindow.document.body;
var text = "innerText" in body ? "innerText" : "textContent";
body[text] = Array.from(document.querySelector('.main-view-container__content').querySelectorAll('.mo-artist')).map((box) => (Array.from(box.querySelectorAll('.mo-info')))).map((artists) => (artists.map((artist) => (artist.textContent)).join(', '))).join('\n');
var newWindow = window.open("");
var body = newWindow.document.body;
var text = "innerText" in body ? "innerText" : "textContent";
body[text] = Array.from(document.querySelector('.Root__main-view').querySelectorAll('.tracklist-row')).map((box) => (Array.from(box.querySelectorAll('.tracklist-row__artist-name-link')))).map((artists) => (artists.map((artist) => (artist.textContent)).join(', '))).join('\n');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.