def urltype(self):
z=min(len(urlcomplaints)-1, self.count-1)
return urlcomplaints[z]
-
-urlre = re.compile("(https?://[^ ]+)( |$)")
+
+#(?:) is a regexp that doesn't group
+urlre = re.compile("((?:(?:http)|(?:nsfw))s?://[^ ]+)( |$)")
urlcomplaints = ["a contemporary","an interesting","a fascinating","an overused","a vastly overused"]
### Deal with /msg bot url or ~url in channel
# canonicalise BBC URLs (internal use only)
def canonical_url(urlstring):
+ if "nsfw://" in urlstring or "nsfws://" in urlstring:
+ urlstring=urlstring.replace("nsfw","http",1)
if (urlstring.find("news.bbc.co.uk") != -1):
for middle in ("/low/","/mobile/"):
x = urlstring.find(middle)