mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-29 06:51:12 -05:00
TextArt: try/except content decoding
This commit is contained in:
parent
db51fe1404
commit
b1f78a1588
@ -1119,7 +1119,10 @@ class TextArt(callbacks.Plugin):
|
|||||||
log.debug("TextArt: error retrieving data for scroll: {0}".format(e))
|
log.debug("TextArt: error retrieving data for scroll: {0}".format(e))
|
||||||
return
|
return
|
||||||
if "text/plain" in r.headers["content-type"]:
|
if "text/plain" in r.headers["content-type"]:
|
||||||
file = r.content.decode().replace("\r\n", "\n")
|
try:
|
||||||
|
file = r.content.decode().replace("\r\n", "\n")
|
||||||
|
except:
|
||||||
|
file = r.text.replace("\r\n", "\n")
|
||||||
else:
|
else:
|
||||||
irc.reply("Invalid file type.", private=False, notice=False)
|
irc.reply("Invalid file type.", private=False, notice=False)
|
||||||
return
|
return
|
||||||
@ -1749,7 +1752,10 @@ class TextArt(callbacks.Plugin):
|
|||||||
irc.reply("Error: No results found for {0}".format(search))
|
irc.reply("Error: No results found for {0}".format(search))
|
||||||
return
|
return
|
||||||
data = requests.get(url.get("href"), headers=header, timeout=10)
|
data = requests.get(url.get("href"), headers=header, timeout=10)
|
||||||
output = data.content.decode()
|
try:
|
||||||
|
output = data.content.decode()
|
||||||
|
except:
|
||||||
|
output = data.text
|
||||||
output = output.splitlines()
|
output = output.splitlines()
|
||||||
asyncio.run(self.reply(irc, output, channel, delay))
|
asyncio.run(self.reply(irc, output, channel, delay))
|
||||||
irc.reply(url.get("href"))
|
irc.reply(url.get("href"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user