Exemple #1
0
def crawlDeeper(list, list_name):
    new_list[:] = []
    for user in list:
        print 'checking %s' % user
        user = user.lower()
        try:
            candidates = get_list(user,list_name)

            for candidate in candidates:
                print '--checking candidate %s isn\'t already in trust list' % candidate.screen_name
                #makeobservation('interstar','1mentat', 'tne-github', datetime.datetime.now())
                try:
                    netdb.makeobservation(user, candidate.screen_name.lower(), list_name, datetime.datetime.now())
                except:
                    print "Unexpected error:", sys.exc_info()[0]
                    print "netdb observation failed"
                if args.dot_file_name != None:
                    dotfile.write("    \"{0}\" -> \"{1}\"\n".format(user, candidate.screen_name.lower()))
                try:
                    trust_list.index(candidate.screen_name.lower())
                except:
                    print '--adding user %s to trust list' % candidate.screen_name.lower()
                    trust_list.append(candidate.screen_name.lower())
                    new_list.append(candidate.screen_name.lower())
        except:
            continue
    return new_list
Exemple #2
0
def crawlDeeper(list, list_name):
    new_list[:] = []
    for user in list:
        print 'checking %s' % user
        user = user.lower()
        try:
            candidates = api.list_members(user,list_name)

            # Fix for differences between Phil's and Eli's list_members function. (A tweepy issue?)
            # Please remove when we've resolved this
            print candidates
            if not (candidates[0].__class__.__name__ == "User") :
                candidates = candidates[0]
            # End of Fix


            for candidate in candidates:
                print '--checking candidate %s isn\'t already in trust list' % candidate.screen_name
#makeobservation('interstar','1mentat', 'tne-github', datetime.datetime.now())
                try:
                    netdb.makeobservation(user, candidate.screen_name.lower(), list_name, datetime.datetime.now())
                except:
                    print "Unexpected error:", sys.exc_info()[0]
                    print "netdb observation failed"
                if args.dot_file_name != None:
                    dotfile.write("    \"{0}\" -> \"{1}\"\n".format(user, candidate.screen_name.lower()))
                try:
                    trust_list.index(candidate.screen_name.lower())
                except:
                    print '--adding user %s to trust list' % candidate.screen_name.lower()
                    trust_list.append(candidate.screen_name.lower())
                    new_list.append(candidate.screen_name.lower())
        except:
            continue
    return new_list
Exemple #3
0
def recurse(depth, user_name, list_name) :
    """ The recursive step, crawls the tree and fills the "visited" SetDict.
    Breadth-first search. (So that we place people as high as they deserve in the depth tree)"""
    people = [p.screen_name.lower() for p in get_list(user_name,list_name)]
    queue = []
    for p in people :
        if dotfile : dotfile.write('    "%s" -> "%s"\n' % (user_name,p))
        netdb.makeobservation(user_name, p, list_name, datetime.datetime.now())
        if not visited.contains(p) :
            visited.insert(depth,p)
            queue.append(p)
    for p in queue :        
        recurse(depth+1,p,list_name)