Spaces:
Running
Running
Refactor response dict to have song above artist
Browse files- .gitignore +2 -0
- app/main.py +4 -2
.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
*test*
|
2 |
+
.env
|
app/main.py
CHANGED
@@ -6,7 +6,7 @@ from datetime import datetime
|
|
6 |
from fastapi import FastAPI
|
7 |
|
8 |
|
9 |
-
API_URL = "https://
|
10 |
|
11 |
def ist_time():
|
12 |
ist_timezone = pytz.timezone('Asia/Kolkata')
|
@@ -28,14 +28,16 @@ def get_data():
|
|
28 |
header_text = soup.find("div", class_="playing").text.split(" on")[0]
|
29 |
artist = soup.find("div", class_="song").text
|
30 |
song = soup.find("div", class_="artist").text
|
|
|
31 |
|
32 |
curr_time = ist_time()
|
33 |
|
34 |
return {
|
|
|
35 |
"header": header_text,
|
36 |
"song": song,
|
37 |
"artist": artist,
|
38 |
-
"
|
39 |
}
|
40 |
|
41 |
if __name__ == "__main__":
|
|
|
6 |
from fastapi import FastAPI
|
7 |
|
8 |
|
9 |
+
API_URL = "https://spotify-github-profile.kittinanx.com/api/view?uid=314en4ia7eeyco74hvxp6254hmam&cover_image=true&theme=default&show_offline=false&background_color=121212&interchange=true&bar_color_cover=true"
|
10 |
|
11 |
def ist_time():
|
12 |
ist_timezone = pytz.timezone('Asia/Kolkata')
|
|
|
28 |
header_text = soup.find("div", class_="playing").text.split(" on")[0]
|
29 |
artist = soup.find("div", class_="song").text
|
30 |
song = soup.find("div", class_="artist").text
|
31 |
+
base64_cover = soup.findAll("img")[1].attrs["src"].split("base64,")[1].strip()
|
32 |
|
33 |
curr_time = ist_time()
|
34 |
|
35 |
return {
|
36 |
+
"time": curr_time,
|
37 |
"header": header_text,
|
38 |
"song": song,
|
39 |
"artist": artist,
|
40 |
+
"album_cover": base64_cover,
|
41 |
}
|
42 |
|
43 |
if __name__ == "__main__":
|