TextArt: format pastebin URLs to /raw/

This commit is contained in:
Gordon Shumway 2020-02-22 17:02:33 -05:00 committed by GitHub
parent 7335b156d8
commit ff7cc0b24c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1135,7 +1135,9 @@ class TextArt(callbacks.Plugin):
else:
delay = self.registryValue('delay', msg.args[0])
if url.startswith("https://paste.ee/p/"):
url = re.sub("https://paste.ee/p/", "https://paste.ee/r/", url)
url = url.replace("https://paste.ee/p/", "https://paste.ee/r/")
elif url.startswith("https://pastebin.com/") and '/raw/' not in url:
url = url.replace("https://pastebin.com/", "https://pastebin.com/raw/")
ua = UserAgent()
header = {'User-Agent':str(ua.random)}
r = requests.head(url, headers=header)