arpy8 commited on
Commit
26a71a5
·
1 Parent(s): 868a0dd

Refactor response dict to have song above artist

Browse files
Files changed (2) hide show
  1. .gitignore +2 -0
  2. 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://camo.githubusercontent.com/37a440b0f0eea5e2e1c51101f9e751ea267d2e57bc0b79a241d52c7de547df45/68747470733a2f2f73706f746966792d6769746875622d70726f66696c652e76657263656c2e6170702f6170692f766965773f7569643d333134656e34696137656579636f37346876787036323534686d616d26636f7665725f696d6167653d74727565267468656d653d64656661756c742673686f775f6f66666c696e653d66616c7365266261636b67726f756e645f636f6c6f723d31323132313226696e7465726368616e67653d74727565266261725f636f6c6f723d346562313666266261725f636f6c6f725f636f7665723d74727565"
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
- "time": curr_time
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__":