66
77# This will match ANY we url including youtube, reddit, twitch, etc... Some additional work needs to go into
88# not sending the web request etc if the match also matches an existing web regex.
9- blacklist = re .compile ('.*(reddit\.com|redd.it|youtube.com|youtu.be|spotify.com|twitter.com|twitch.tv|amazon.co|xkcd.com|amzn.com |steamcommunity.com|steampowered.com|newegg.com).*' , re .I )
9+ blacklist = re .compile ('.*(reddit\.com|redd.it|youtube.com|youtu.be|spotify.com|twitter.com|twitch.tv|amazon.co|xkcd.com|amzn.co |steamcommunity.com|steampowered.com|newegg.com|vimeo .com).*' , re .I )
1010url_re = re .compile ('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+' )
1111
12- opt_in = ["#gonzobot" ]
12+ opt_out = []
1313
1414traditional = [
1515 (1024 ** 5 , 'PB' ),
@@ -32,7 +32,7 @@ def bytesto(bytes, system = traditional):
3232
3333@hook .regex (url_re )
3434def print_url_title (message , match , chan ):
35- if chan not in opt_in :
35+ if chan in opt_out :
3636 return
3737 if re .search (blacklist , match .group ()):
3838 return
@@ -41,10 +41,12 @@ def print_url_title(message, match, chan):
4141 }
4242 with closing (requests .get (match .group (), headers = HEADERS , stream = True )) as r :
4343 if not r .encoding :
44- content = r .headers ['content-type' ]
45- size = bytesto (r .headers ['content-length' ])
46- out = "Content Type: \x02 {}\x02 Size: \x02 {}\x02 " .format (content , size )
47- return out
44+ # remove the content type and size from output for now
45+ return
46+ #content = r.headers['content-type']
47+ #size = bytesto(r.headers['content-length'])
48+ #out = "Content Type: \x02{}\x02 Size: \x02{}\x02".format(content, size)
49+ #return out
4850 html = BeautifulSoup (r .text )
4951 title = " " .join (html .title .text .strip ().splitlines ())
5052 out = "Title: \x02 {}\x02 " .format (title )
0 commit comments