-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
24 lines (20 loc) · 679 Bytes
/
main.py
File metadata and controls
24 lines (20 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from scrape import Scrape
from spotify_apis import Spotify
user_date = input("Which year do you want to travel to? Enter the date in this format YYYY-MM-DD: ")
# Data from billboards
scrape = Scrape(user_date)
data = scrape.scrape_data()
for i in range(len(data)):
print(f"Song {i+1}: {data[i]}")
# Search songs from spotify
spotify = Spotify()
spotify.authenticate()
user_id = spotify.get_profile()
playlist_id = spotify.create_playlist(playlist_name=f'Billboard\'s hot songs - {user_date}')
uris = []
for song in data:
uri = spotify.search(song)
uris.append(f"{uri}")
# uris = uris.split(', ')
print(uris, len(uris))
spotify.add_song_to_list(playlist_id, uris)