]> PatchyGit - angel.git/commitdiff
don't fetch private urls* master
authorKyle Czar <czar@kalli.st>
Wed, 2 Apr 2025 19:43:36 +0000 (16:43 -0300)
committerKyle Czar <czar@kalli.st>
Wed, 2 Apr 2025 19:43:36 +0000 (16:43 -0300)
main.py

diff --git a/main.py b/main.py
index 7a6dfe9..9f5a4ae 100644 (file)
--- a/main.py
+++ b/main.py
@@ -119,10 +119,14 @@ 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)
         netloc = uri.netloc
         if self.invidious_instances and netloc in (self.youtube_links + [youtube_link]):
             self.send_youtube_info(uri, sender, mtype)
-        elif ipaddress.ip_address(netloc.split(":")[0]).is_private:
             return
             return
-        else:
-            await self.process_link(uri, sender, mtype)
+        try:
+            if ipaddress.ip_address(netloc.split(":")[0]).is_private:
+                return
+        except ValueError:
+            pass
+        
+        await self.process_link(uri, sender, mtype)
 
     async def process_link(self, uri, sender, mtype):
         """Process a link and send the result to the sender."""
 
     async def process_link(self, uri, sender, mtype):
         """Process a link and send the result to the sender."""