mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-28 22:41:08 -05:00
set fake-useragent fallback
This commit is contained in:
parent
4f4f3caf03
commit
2b2108d0d8
@ -55,7 +55,7 @@ class IMDb(callbacks.Plugin):
|
|||||||
try:
|
try:
|
||||||
url = None
|
url = None
|
||||||
searchurl = "https://www.google.com/search?&q={0} site:imdb.com/title/".format(query)
|
searchurl = "https://www.google.com/search?&q={0} site:imdb.com/title/".format(query)
|
||||||
ua = UserAgent()
|
ua = UserAgent(fallback="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0")
|
||||||
header = {'User-Agent':str(ua.random)}
|
header = {'User-Agent':str(ua.random)}
|
||||||
data = requests.get(searchurl, headers=header, timeout=10)
|
data = requests.get(searchurl, headers=header, timeout=10)
|
||||||
data.raise_for_status()
|
data.raise_for_status()
|
||||||
|
@ -58,7 +58,7 @@ class Lyrics(callbacks.Plugin):
|
|||||||
url = None
|
url = None
|
||||||
title = None
|
title = None
|
||||||
searchurl = "https://www.google.com/search?&q={0} site:lyrics.fandom.com/wiki/".format(lyric)
|
searchurl = "https://www.google.com/search?&q={0} site:lyrics.fandom.com/wiki/".format(lyric)
|
||||||
ua = UserAgent()
|
ua = UserAgent(fallback="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0")
|
||||||
header = {'User-Agent':str(ua.random)}
|
header = {'User-Agent':str(ua.random)}
|
||||||
data = requests.get(searchurl, headers=header, timeout=10)
|
data = requests.get(searchurl, headers=header, timeout=10)
|
||||||
data.raise_for_status()
|
data.raise_for_status()
|
||||||
|
@ -713,7 +713,7 @@ class TextArt(callbacks.Plugin):
|
|||||||
fg = 0
|
fg = 0
|
||||||
if url.startswith("https://paste.ee/p/"):
|
if url.startswith("https://paste.ee/p/"):
|
||||||
url = re.sub("https://paste.ee/p/", "https://paste.ee/r/", url)
|
url = re.sub("https://paste.ee/p/", "https://paste.ee/r/", url)
|
||||||
ua = UserAgent()
|
ua = UserAgent(fallback="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0")
|
||||||
header = {'User-Agent':str(ua.random)}
|
header = {'User-Agent':str(ua.random)}
|
||||||
r = requests.head(url, headers=header)
|
r = requests.head(url, headers=header)
|
||||||
if "text/plain" in r.headers["content-type"] or url.startswith('https://paste.ee/r/'):
|
if "text/plain" in r.headers["content-type"] or url.startswith('https://paste.ee/r/'):
|
||||||
@ -900,7 +900,7 @@ class TextArt(callbacks.Plugin):
|
|||||||
path = os.path.dirname(os.path.abspath(__file__))
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
filepath = "{0}/tmp".format(path)
|
filepath = "{0}/tmp".format(path)
|
||||||
filename = "{0}/{1}".format(filepath, url.split('/')[-1])
|
filename = "{0}/{1}".format(filepath, url.split('/')[-1])
|
||||||
ua = UserAgent()
|
ua = UserAgent(fallback="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0")
|
||||||
header = {'User-Agent':str(ua.random)}
|
header = {'User-Agent':str(ua.random)}
|
||||||
image_formats = ("image/png", "image/jpeg", "image/jpg", "image/gif")
|
image_formats = ("image/png", "image/jpeg", "image/jpg", "image/gif")
|
||||||
r = requests.head(url, headers=header)
|
r = requests.head(url, headers=header)
|
||||||
@ -1161,7 +1161,7 @@ class TextArt(callbacks.Plugin):
|
|||||||
url = url.replace("https://paste.ee/p/", "https://paste.ee/r/")
|
url = url.replace("https://paste.ee/p/", "https://paste.ee/r/")
|
||||||
elif url.startswith("https://pastebin.com/") and '/raw/' not in url:
|
elif url.startswith("https://pastebin.com/") and '/raw/' not in url:
|
||||||
url = url.replace("https://pastebin.com/", "https://pastebin.com/raw/")
|
url = url.replace("https://pastebin.com/", "https://pastebin.com/raw/")
|
||||||
ua = UserAgent()
|
ua = UserAgent(fallback="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0")
|
||||||
header = {'User-Agent':str(ua.random)}
|
header = {'User-Agent':str(ua.random)}
|
||||||
r = requests.head(url, headers=header)
|
r = requests.head(url, headers=header)
|
||||||
if "text/plain" in r.headers["content-type"]:
|
if "text/plain" in r.headers["content-type"]:
|
||||||
@ -1209,7 +1209,7 @@ class TextArt(callbacks.Plugin):
|
|||||||
delay = optlist.get('delay')
|
delay = optlist.get('delay')
|
||||||
else:
|
else:
|
||||||
delay = self.registryValue('delay', msg.args[0])
|
delay = self.registryValue('delay', msg.args[0])
|
||||||
ua = UserAgent()
|
ua = UserAgent(fallback="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0")
|
||||||
header = {'User-Agent':str(ua.random)}
|
header = {'User-Agent':str(ua.random)}
|
||||||
r = requests.head(url, headers=header)
|
r = requests.head(url, headers=header)
|
||||||
try:
|
try:
|
||||||
@ -1295,7 +1295,7 @@ class TextArt(callbacks.Plugin):
|
|||||||
path = os.path.dirname(os.path.abspath(__file__))
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
filepath = "{0}/tmp".format(path)
|
filepath = "{0}/tmp".format(path)
|
||||||
filename = "{0}/{1}".format(filepath, url.split('/')[-1])
|
filename = "{0}/{1}".format(filepath, url.split('/')[-1])
|
||||||
ua = UserAgent()
|
ua = UserAgent(fallback="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0")
|
||||||
header = {'User-Agent':str(ua.random)}
|
header = {'User-Agent':str(ua.random)}
|
||||||
image_formats = ("image/png", "image/jpeg", "image/jpg", "image/gif")
|
image_formats = ("image/png", "image/jpeg", "image/jpg", "image/gif")
|
||||||
r = requests.head(url, headers=header)
|
r = requests.head(url, headers=header)
|
||||||
@ -1666,7 +1666,7 @@ class TextArt(callbacks.Plugin):
|
|||||||
else:
|
else:
|
||||||
delay = self.registryValue('delay', msg.args[0])
|
delay = self.registryValue('delay', msg.args[0])
|
||||||
self.stopped[msg.args[0]] = False
|
self.stopped[msg.args[0]] = False
|
||||||
ua = UserAgent()
|
ua = UserAgent(fallback="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0")
|
||||||
header = {'User-Agent':str(ua.random)}
|
header = {'User-Agent':str(ua.random)}
|
||||||
data = requests.get("https://mircart.org/?s={0}".format(search), headers=header)
|
data = requests.get("https://mircart.org/?s={0}".format(search), headers=header)
|
||||||
soup = BeautifulSoup(data.text)
|
soup = BeautifulSoup(data.text)
|
||||||
|
@ -58,7 +58,7 @@ class YouTube(callbacks.Plugin):
|
|||||||
try:
|
try:
|
||||||
url = None
|
url = None
|
||||||
searchurl = "https://www.google.com/search?&q={0} site:youtube.com".format(query)
|
searchurl = "https://www.google.com/search?&q={0} site:youtube.com".format(query)
|
||||||
ua = UserAgent()
|
ua = UserAgent(fallback="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0")
|
||||||
header = {'User-Agent':str(ua.random)}
|
header = {'User-Agent':str(ua.random)}
|
||||||
data = requests.get(searchurl, headers=header, timeout=10)
|
data = requests.get(searchurl, headers=header, timeout=10)
|
||||||
data.raise_for_status()
|
data.raise_for_status()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user