Jump to content

store the data instead of printing it - in to a mysql-db


Recommended Posts

Guest sayhello
Posted

want to store the data - instead of printing out

there fore i set up a mysqldb on the suse

Code:

import urllib

import urlparse

import re

 

url = "http://search.cpan.org/author/?W"

html = urllib.urlopen(url).read()

for lk, capname, name in re.findall('<a href="(/~.*?/)"><b>(.*?)</b></

a><br/><small>(.*?)</small>', html):

alk = urlparse.urljoin(url, lk)

 

data = { 'url':alk, 'name':name, 'cname':capname }

 

phtml = urllib.urlopen(alk).read()

memail = re.search('<a href="mailto:(.*?)">', phtml)

if memail:

data['email'] = memail.group(1)

 

print data

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...