Exemplo n.º 1
0
        origin = 1  # the homepage of fans is a little different from the others'
    else:
        origin = 0  
    #try:
    if( not os.path.exists(str(uid))):
        os.mkdir(str(uid))
    try:
        blog = blogcrawler.scratch(str(uid))    # get users blogs 
        if(len(blog)>2000):
            continue
        # modified on 9/11
        writefile.write_blog(uid,blog)          # write them in the file    
        print "Blogs of "+str(uid)+" were recorded."
        friendcrawler = FriendCrawler(uid,origin)   # get users friends
        friends = friendcrawler.scratch()
        writefile.write_fans(uid,friends)     # write friends info
        print "Fans of "+str(uid)+" were recorded."
        followcrawler = FollowCrawler(uid,origin)
        follow = followcrawler.scratch()
        writefile.write_follows(uid,follow)
        print "Follows of "+str(uid)+" were recorded."
        fopen_id = open(str(uid)+"/"+str(uid)+"_fans_id.txt","r")       
    # read friends from the file saved above

        while True:    
            new_friend = fopen_id.readline()
            if(new_friend):       
                new_friend = new_friend.split()
                new_friend = new_friend[0]
                if(new_friend in searched):
                    continue