change split character to |

This commit is contained in:
Gordon Shumway 2019-02-25 18:36:47 -05:00 committed by GitHub
parent c23a9a7249
commit a532f6fdab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -32,13 +32,13 @@ class Lyrics(callbacks.Plugin):
"""
channel = msg.args[0]
lyrics = None
if ',' in lyric:
query = lyric.split(', ')
if '|' in lyric:
query = lyric.split('|')
else:
irc.reply("Searches must be formatted as artist, song title")
query = None
if query:
data = requests.get("https://lyric-api.herokuapp.com/api/find/{0}/{1}".format(query[0], query[1])).json()
data = requests.get("https://lyric-api.herokuapp.com/api/find/{0}/{1}".format(query[0].strip(), query[1].strip())).json()
lyrics = html.unescape(data['lyric']).replace('\n\n', '. ').replace('?\n', '? ').replace('!\n', '! ').replace('.\n', '. ').replace(',\n', ', ').replace('...\n', '... ').replace('\n', ', ')
if lyrics:
irc.reply(lyrics)