minor changes in a python script - an easy one ;-)

Einfach Dinge, die nichts mit XAMPP, Apache Friends, Apache, MySQL, PHP und alle dem zu tun haben. Allerlei halt. ;)

minor changes in a python script - an easy one ;-)

Postby unleash » 23. June 2013 12:17

Hi there, good day dear Linux and Coding-Experts.

- want to run the following scritp with the URL from a to z

that means we have to change
Code: Select all
url = "http://search.cpan.org/author/?a"

Code: Select all
url = "http://search.cpan.org/author/?z"

how to change the term in the code...

Code: Select all
import urllib
import urlparse
import re

url = "http://search.cpan.org/author/?X"
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

any idea ?

greetings leash
Posts: 143
Joined: 03. December 2011 10:16
Operating System: OpenSuse Linux 12.1

Return to Allerlei

Who is online

Users browsing this forum: No registered users and 2 guests