Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib2
- import re
- urls = ["http://www.youtube.com/watch?v=kPhZDsJUXic","http://www.google.com"]
- i = 0
- regex = '<title>(.*)</title>'
- pattern = re.compile(regex)
- while i< len (urls):
- response = urllib2.urlopen(urls[i])
- htmltext = response.read()
- titles = re.findall(pattern, htmltext)
- print titles
- i+=1
- response.close()
Advertisement
Add Comment
Please, Sign In to add comment