

def usernames(urls):
    'Take an iterable of `urls` of normalized URL or file paths and\n    attempt to extract usernames.  Returns a list.\n\n    '
    usernames = StringCounter()
    for (url, count) in urls.items():
        uparse = urlparse(url)
        path = uparse.path
        hostname = uparse.hostname
        m = username_re.match(path)
        if m:
            usernames[m.group('username')] += count
        elif (hostname in ['twitter.com', 'www.facebook.com']):
            usernames[path.lstrip('/')] += count
    return usernames

dataset/ETHPy150Open dossier/dossier.web/dossier/extraction/usernames.py usernames/original