Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- from util import hook, urlnorm, http
- @hook.regex(r'([a-zA-Z]+://|www\.)[^ ]+')
- def show_title(match, nick='', chan='', say=None):
- url = urlnorm.normalize(match.group().encode('utf-8'))
- page = http.get_html(url)
- title = page.xpath('//title')
- if title:
- titleList = []
- for i in title:
- if i.text_content():
- titleList.append(i.text_content().strip())
- titleList = ''.join(titleList)
- if len(titleList) >= 3:
- print "Title List: "+titleList
- string = "URL title: %s" % (''.join(titleList))
- say(string)
Add Comment
Please, Sign In to add comment