-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenius.py
More file actions
26 lines (20 loc) · 730 Bytes
/
genius.py
File metadata and controls
26 lines (20 loc) · 730 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
25
26
import requests
import api_key
import lyricsgenius
client_access_token = api_key.client_access_token
def main():
artist_name = "Sia"
LyricsGenius = lyricsgenius.Genius(client_access_token)
songs = LyricsGenius.search_artist(artist_name, max_songs=2)
song = LyricsGenius.search_song(artist_name, "beautiful people")
print(songs)
print(song.lyrics)
def test( ):
search_term = "sia"
genius_search_url = f"http://api.genius.com/search?q={search_term}&access_token={client_access_token}"
response = requests.get(genius_search_url)
json_data = response.json()
for song in json_data['response']['hits']:
print(song['result']['full_title'])
if __name__ == "__main__":
main()