Spaces:
Sleeping
Sleeping
kmaurinjones
commited on
Commit
•
08ef248
1
Parent(s):
9d24c19
Update songscope.py
Browse files- songscope.py +4 -4
songscope.py
CHANGED
@@ -3,11 +3,8 @@ import requests
|
|
3 |
from bs4 import BeautifulSoup
|
4 |
import time
|
5 |
import random
|
6 |
-
# !python -m pip install levenshtein
|
7 |
-
# import Levenshtein
|
8 |
import nltk
|
9 |
-
|
10 |
-
from azapi import *
|
11 |
from nltk.sentiment import SentimentIntensityAnalyzer
|
12 |
nltk.download("vader_lexicon")
|
13 |
|
@@ -202,6 +199,7 @@ def find_artist(artist_name: str) -> str:
|
|
202 |
|
203 |
# The target URL
|
204 |
url = f"https://www.azlyrics.com/{first_letter}.html"
|
|
|
205 |
|
206 |
# Send an HTTP request to the URL
|
207 |
response = requests.get(url)
|
@@ -228,6 +226,8 @@ def find_artist(artist_name: str) -> str:
|
|
228 |
for url in artist_links:
|
229 |
artist_urls.append(str(url).split("/")[-1][:-5])
|
230 |
|
|
|
|
|
231 |
if artist_name in artist_urls:
|
232 |
return f"https://www.azlyrics.com/{artist_links[artist_urls.index(artist_name)]}"
|
233 |
else:
|
|
|
3 |
from bs4 import BeautifulSoup
|
4 |
import time
|
5 |
import random
|
|
|
|
|
6 |
import nltk
|
7 |
+
from azapi import * # taken from https://github.com/elmoiv/azapi.git
|
|
|
8 |
from nltk.sentiment import SentimentIntensityAnalyzer
|
9 |
nltk.download("vader_lexicon")
|
10 |
|
|
|
199 |
|
200 |
# The target URL
|
201 |
url = f"https://www.azlyrics.com/{first_letter}.html"
|
202 |
+
print(url)
|
203 |
|
204 |
# Send an HTTP request to the URL
|
205 |
response = requests.get(url)
|
|
|
226 |
for url in artist_links:
|
227 |
artist_urls.append(str(url).split("/")[-1][:-5])
|
228 |
|
229 |
+
print(artist_urls)
|
230 |
+
|
231 |
if artist_name in artist_urls:
|
232 |
return f"https://www.azlyrics.com/{artist_links[artist_urls.index(artist_name)]}"
|
233 |
else:
|