summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f735103)
Servus should now understand nsfw:// and nsfws:// urls, and understand
that these are the same as the relevant http:// and https:// URL
def urltype(self):
z=min(len(urlcomplaints)-1, self.count-1)
return urlcomplaints[z]
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
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):
# 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)
if (urlstring.find("news.bbc.co.uk") != -1):
for middle in ("/low/","/mobile/"):
x = urlstring.find(middle)