26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
enabled=False
|
|
"""
|
|
Lyrics fandom has been deleted with no notice and no reason given, even when asked directly.
|
|
It will never be reinstated, this file will never work again. It can be safely deleted.
|
|
It's still included as a reminder of one of the nice things we just can't have thanks to, probably, copyright.
|
|
"""
|
|
|
|
def lyrics(band,song):
|
|
#Remote
|
|
p={'format':'json', 'action':'parse', 'prop':'wikitext', 'page':f'{band}:{song}'}
|
|
lyrics=r.get('https://lyrics.fandom.com/api.php',params=p)
|
|
try:
|
|
lyrics=lyrics.json()['parse']['wikitext']['*']
|
|
except KeyError: return "Couldn't find it boi"
|
|
#Follow redirects
|
|
while '#redirect' in lyrics.lower():
|
|
p['page']=lyrics[lyrics.index('[[')+2:lyrics.index(']]')]
|
|
lyrics=r.get('https://lyrics.fandom.com/api.php',params=p).json()['parse']['wikitext']['*']
|
|
out=lyrics[lyrics.index('<lyrics>')+8:lyrics.index('</lyrics>')]
|
|
return out
|
|
|
|
def url(band,song):
|
|
p={'format':'json', 'action':'parse', 'prop':'wikitext', 'page':f'{band}:{song}'}
|
|
p="&".join([f'{k}={v}' for k,v in p.items()])
|
|
return f'https://lyrics.fandom.com/wiki/{band}:{song}',f'https://lyrics.fandom.com/api.php?{p}'
|