Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 34 lines (24 sloc) 0.838 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
#! /usr/bin/env python

import urllib2
import BeautifulSoup

URL = 'https://alioth.debian.org/users/{0}'
OUTPUT = '{0}\t\t\t\t\t:\t\t\t{1}\n'


def main():
    out = open('matchednames.list', 'w')

    total = 0
    failed = 0
    with open('lookupnames.list') as f:
        for line in f:
            soup = BeautifulSoup.BeautifulSoup(urllib2.urlopen(URL.format(line.strip())).read())
            try:
                name = soup.find('span', {'property': 'foaf:name'}).renderContents()
                total += 1
            except AttributeError:
                print 'Nothing found for user:', line,
                failed += 1
                continue

            out.write(OUTPUT.format(name, line.strip()))
            out.flush()

    out.close()
    
    print 'Downloaded: {0}, Failed: {1}'.format(total, failed)
    
main()
Something went wrong with that request. Please try again.