don't fetch private urls
This commit is contained in:
parent
f351707290
commit
617d5c6a98
1 changed files with 2 additions and 3 deletions
5
main.py
5
main.py
|
|
@ -13,6 +13,7 @@ from slixmpp import ClientXMPP
|
|||
from urllib.parse import urlparse, parse_qs, urlunparse
|
||||
from pantomime import normalize_mimetype
|
||||
import cgi
|
||||
import ipaddress
|
||||
|
||||
sed_parse = re.compile("(?<!\\\\)[/#]")
|
||||
sed_cmd = re.compile("^s[/#].*[/#].*[/#]")
|
||||
|
|
@ -33,8 +34,6 @@ youtube_link = "youtu.be"
|
|||
|
||||
ydl = youtube_dl.YoutubeDL()
|
||||
|
||||
block_list = ("localhost", "127.0.0.1", "0.0.0.0")
|
||||
|
||||
req_list = ("http://", "https://")
|
||||
|
||||
html_files = ("text/html", "application/xhtml+xml")
|
||||
|
|
@ -120,7 +119,7 @@ class AngelBot(ClientXMPP):
|
|||
netloc = uri.netloc
|
||||
if self.invidious_instances and netloc in (self.youtube_links + [youtube_link]):
|
||||
self.send_youtube_info(uri, sender, mtype)
|
||||
elif netloc.split(":")[0] in block_list:
|
||||
elif ipaddress.ip_address(netloc.split(":")[0]).is_private:
|
||||
return
|
||||
else:
|
||||
await self.process_link(uri, sender, mtype)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue