elmoiv / azapi Goto Github PK
View Code? Open in Web Editor NEWGet Lyrics from AZLyrics.com like a Boss ~(0_0)~
License: GNU General Public License v3.0
Get Lyrics from AZLyrics.com like a Boss ~(0_0)~
License: GNU General Public License v3.0
Describe the bug
getSongs() fails to retrieve all songs from an artist
To Reproduce
from azapi import AZlyrics
import pprint
API = AZlyrics('google', accuracy=0.5)
API.artist = 'bangtanboys'
songs = API.getSongs()
pprint.pprint(songs, indent=2)
printed json
{
"24/7=Heaven": {
"album": "Dark & Wild",
"type": "album",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/247heaven.html",
"year": "2014"
},
"2nd Grade (2학년)": {
"album": "Dark & Wild",
"type": "album",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/2ndgrade2.html",
"year": "2014"
},
"Attack On Bangtan (진격의 방탄; Jingyeogui Bangtan)": {
"album": "O!RUL8,2?",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/attackonbangtanjingyeoguibangtan.html",
"year": "2013"
},
"BTS Cypher Pt. 1": {
"album": "O!RUL8,2?",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/btscypherpt1.html",
"year": "2013"
},
"BTS Cypher Pt. 2: Triptych": {
"album": "Skool Luv Affair",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/btscypherpt2triptych.html",
"year": "2014"
},
"BTS Cypher Pt. 3: Killer": {
"album": "Dark & Wild",
"type": "album",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/btscypherpt3killer.html",
"year": "2014"
},
"Blanket Kick (이불킥)": {
"album": "Dark & Wild",
"type": "album",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/blanketkick.html",
"year": "2014"
},
"Boy In Luv (상남자; Sang-Namja)": {
"album": "Skool Luv Affair",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/boyinluvsangnamja.html",
"year": "2014"
},
"Can You Turn Off Your Cellphone? (핸드폰 좀 꺼줄래)": {
"album": "Dark & Wild",
"type": "album",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/canyouturnoffyourcellphone.html",
"year": "2014"
},
"Coffee": {
"album": "O!RUL8,2?",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/coffee.html",
"year": "2013"
},
"Danger": {
"album": "Dark & Wild",
"type": "album",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/danger.html",
"year": "2014"
},
"Does That Make Sense? (Outro) (그게 말이 돼? (Outro))": {
"album": "Dark & Wild",
"type": "album",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/doesthatmakesenseoutrooutro.html",
"year": "2014"
},
"Hip Hop Lover (힙합성애자)": {
"album": "Dark & Wild",
"type": "album",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/hiphoplover.html",
"year": "2014"
},
"I Like It (Slow Jam Remix) (좋아요; Joh-Ayo)": {
"album": "Skool Luv Affair",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/ilikeitslowjamremixjohayo.html",
"year": "2014"
},
"I Like It (좋아요; Joayo)": {
"album": "2 Cool 4 Skool",
"type": "single",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/ilikeitjoayo.html",
"year": "2013"
},
"If I Ruled The World": {
"album": "O!RUL8,2?",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/ifiruledtheworld.html",
"year": "2013"
},
"Interlude: What Are You Doing? (Interlude:뭐해; Interlude: Mwohae)": {
"album": "Dark & Wild",
"type": "album",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/interludewhatareyoudoinginterludeinterludemwohae.html",
"year": "2014"
},
"Intro: 2 Cool 4 Skool": {
"album": "2 Cool 4 Skool",
"type": "single",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/intro2cool4skool.html",
"year": "2013"
},
"Intro: O!RUL8,2": {
"album": "O!RUL8,2?",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/introorul82.html",
"year": "2013"
},
"Intro: Skool Luv Affair": {
"album": "Skool Luv Affair",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/introskoolluvaffair.html",
"year": "2014"
},
"Jump": {
"album": "Skool Luv Affair",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/jump.html",
"year": "2014"
},
"Just One Day (하루만; Haruman)": {
"album": "Skool Luv Affair",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/justonedayharuman.html",
"year": "2014"
},
"Let Me Know": {
"album": "Dark & Wild",
"type": "album",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/letmeknow.html",
"year": "2014"
},
"Look Here (여기 봐)": {
"album": "Dark & Wild",
"type": "album",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/lookhere.html",
"year": "2014"
},
"Miss Right": {
"album": "Skool Luv Affair",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/missright.html",
"year": "2014"
},
"N.O": {
"album": "O!RUL8,
2?",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/no.html",
"year": "2013"
},
"No More Dream": {
"album": "2 Cool 4 Skool",
"type": "single",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/nomoredream.html",
"year": "2013"
},
"Outro: Luv In Skool": {
"album": "O!RUL8,
2?",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/outroluvinskool.html",
"year": "2013"
},
"Outro: Propose": {
"album": "Skool Luv Affair",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/outropropose.html",
"year": "2014"
},
"Path (길; Gil)": {
"album": "2 Cool 4 Skool",
"type": "single",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/pathgil.html",
"year": "2013"
},
"Rain": {
"album": "Dark & Wild",
"type": "album",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/rain.html",
"year": "2014"
},
"Satoori Rap (팔도강산; Paldogangsan)": {
"album": "O!RUL8,2?",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/satoorirappaldogangsan.html",
"year": "2013"
},
"Skit: Soulmate": {
"album": "Skool Luv Affair",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/skitsoulmate.html",
"year": "2014"
},
"Spine Breaker (등골브레이커; Deung-Gol Beuleikeo)": {
"album": "Skool Luv Affair",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/spinebreakerdeunggolbeuleikeo.html",
"year": "2014"
},
"Tomorrow": {
"album": "Skool Luv Affair",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/tomorrow.html",
"year": "2014"
},
"War Of Hormone (호르몬 전쟁)": {
"album": "Dark & Wild",
"type": "album",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/warofhormone.html",
"year": "2014"
},
"We Are Bulletproof Pt. 2": {
"album": "2 Cool 4 Skool",
"type": "single",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/wearebulletproofpt2.html",
"year": "2013"
},
"We On": {
"album": "O!RUL8,2?",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/weon.html",
"year": "2013"
},
"What Am I To You (Intro)": {
"album": "Dark & Wild",
"type": "album",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/whatamitoyouintro.html",
"year": "2014"
},
"Where Did You Come From? (어디에서 왔는지; Eodieseo Wassneunji)": {
"album": "Skool Luv Affair",
"type": "EP",
"url": "http: //www.azlyrics.com/lyrics/bangtanboys/wheredidyoucomefromeodieseowassneunji.html",
"year": "2014"
}
}
Expected behavior
When going to the url: https://www.azlyrics.com/b/bangtanboys.html
we can see how songs have been chopped off in the print statement when compared to the actual list of songs on AZlyrics.com.
I believe this issue has to do the the ParseSongs() method in tools.py.
AZlyrics seems to include google adds in one under a certain div tag and I think this is causing early termination possibly.
Desktop (please complete the following information):
Using macOS Majove
Additional context
Add any other context about the problem here.
The following code:
from azapi import AZlyrics
api = AZlyrics()
api.artist = "Aaliyah"
songs = api.getSongs()
produces an empty dictionary when I try to print(songs)
.
Desktop (please complete the following information):
Any ideas about what I might be doing wrong? Thanks in advance!
After querying with google api = AZlyrics('google')
could an additional feature be added to update the api.title and api.artist fields with the exact names that also appear on azlyrics[dot]com
Describe the bug
I've uploaded the script to a pythonanywhere instance and am using flask to return results to a website. For any query type I get the response: "Type the characters from the picture above: Input is case-insensitive Submit"
It looks like maybe it's catching a captcha or similar bot detector.
I'm assuming that a proxy might be what is required to bypass - would you mind providing instructions for how to use one - I see the feature flag but wasn't sure how to do it if you think that's what's causing this?
Description:
When a computer on the same network is using VPN, there is a List Index Error for the "metadata" variable in azapi.py. When I printed the variable, its value was "["\r\n Our systems have detected unusual activity from your IP address (computer network). \r\n This page checks to see if it's really you sending the requests, and not a robot.\r\n "]
This error still lingers even after I turn off my VPN.
Steps to reproduce the behavior:
Expected behavior
I expected for the search lyrics to work as normal and return lyrics if they can be found via its process.
Screenshots
If applicable, add screenshots to help explain your problem.
AttributeError: 'NoneType' object has no attribute 'strip'
lyrics = api.getLyrics(url=result_song["url"])
File "azapi\azapi.py", line 88, in getLyrics
self.lyrics = lyrics.strip()
The source of the error is probably the non existing lyrics
Describe the bug
Exception thrown during loading the lyrics.
Traceback (most recent call last):
File "<input>", line 4, in <module>
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\azapi\azapi.py", line 90, in getLyrics
self.lyrics = lyrics.strip()
AttributeError: 'NoneType' object has no attribute 'strip'
To Reproduce
Steps to reproduce the behavior:
api = azapi.AZlyrics('duckduckgo', accuracy=0.5)
api.artist = "Glass Animals"
api.getLyrics(url="http://www.azlyrics.com/lyrics/glassanimals/homemovie1994.html")
Expected behavior
It seem that no lyrics is available but the page exist. Maybe return None
?
I tried with python 3.6.9
>>> import azapi
>>> Artist = azapi.AZlyrics()
>>> lyric = Artist.getLyrics("Taylor Swift", "Bad Blood", save=False)
Traceback (most recent call last):
File "/home/mohit/.virtualenvs/spotify/lib/python3.6/site-packages/azapi/azapi.py", line 71, in getLyrics
artist = filtr(str(htmlFindAll(page)('div', class_='lyricsh')[0])[29:-23], True)
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/mohit/.virtualenvs/spotify/lib/python3.6/site-packages/azapi/azapi.py", line 75, in getLyrics
raise Exception('Artist or Title not found!')
Exception: Artist or Title not found!
>>>
Describe the bug
----> 1 songs = api.getSongs()
1 frames
/usr/local/lib/python3.6/dist-packages/azapi/AZtools.py in filtr(inpt, isFile)
14 if isFile:
15 return ''.join(i for i in inpt if i not in r'<>:"/\|?*')
---> 16 return ''.join(i.lower() for i in inpt if i.lower() in letters)
17
18 def ParseLyric(page):
TypeError: 'NoneType' object is not iterable
To Reproduce
Steps to reproduce the behavior:
`from azapi import AZlyrics
api = AZlyrics('Taylor Swift')
songs = api.getSongs()
`
Expected behavior
self explanatory
Failed to find lyrics. Trying to get link from Google
Google found nothing!
Don't know if this is an issue with azlyrics but when trying to get the songs from someone like Kanye it only works if you search "West". The terms "Kanye West" or "Kanye" throw errors.
Allowing getLyrics()
to receive the desired directory as a string parameter to save the downloaded lyrics would be nice
Describe the bug
I've been having issues with this library I worked on implementing into phonetic-songs and at one point I thought it was the way I phrased the code but then as seen in the screenshot, the same piece of code gave two different outputs immediately after each other so I knew it wasn't from my side.
Along with AttributeError: 'NoneType' object has no attribute 'strip'
, I would get Exception('Artist or Title not found!')
, TypeError: string indices must be integers
, TypeError: write() argument must be str, not None
and IndexError: list index out of range
all with the same piece of code. Perhaps something to do with the way it is fetching the data from AZLyrics?
To Reproduce
Steps to reproduce the behavior:
api = AZlyrics()
search_terms = input('Enter lyrics: ')
songs = api.search(search_terms, category='songs')
song_url = songs[0]['url']
artist_name = songs[0]['artist']
song_title = songs[0]['name']
lyrics = api.getLyrics(url = song_url, save=False).strip()
filename = (artist_name + ' - ' + song_title + '.txt')
if Path('in/').exists():
basepath = Path('in/')
else:
os.mkdir('in')
if Path('in/').exists():
basepath = Path('in/')
with open(basepath/filename,'w', encoding='latin-1') as export:
export.write(lyrics)
export.close()
...
Would also get it with
api = AZlyrics()
artist_name = input('Type in the name of the artist: ')
song_title = input('Type in the title of the song: ')
lyrics = api.getLyrics(artist = artist_name, title = song_title, save=False).strip()
filename = (artist_name + ' - ' + song_title + '.txt')
if Path('in/').exists():
basepath = Path('in/')
else:
os.mkdir('in')
if Path('in/').exists():
basepath = Path('in/')
with open(basepath/filename,'w', encoding='latin-1') as export:
export.write(lyrics)
export.close()
...
Expected behavior
Lyrical output
Desktop (please complete the following information):
Additional context
A collection of the errors thrown with various songs/lyrics
IndexError: list index out of range
and raise Exception('Artist or Title not found!'
)TypeError: write() argument must be str, not None
)AttributeError: 'NoneType' object has no attribute 'strip'
)IndexError: list index out of range
and Exception('Artist or Title not found!'
)Drew Seeley - Christmas Nyc.txt
insteadTypeError: string indices must be integers
)TypeError: write() argument must be str, not None
)TypeError: write() argument must be str, not None
)Exception('Artist or Title not found!')
)TypeError: write() argument must be str, not None
'Describe the bug
getSongs()
returns relative paths to the individual songs
To Reproduce
api = azapi.AZlyrics('duckduckgo', accuracy=0.5)
api.artist = "Oliver Heldens"
api.title = "Lift Me Up"
songs = api.getSongs()
Expected behavior
The url is https://www.azlyrics.com/lyrics/oliverheldens/liftmeup.html
Desktop (please complete the following information):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.