예제 #1
0
sys.exit()

rand_list=[i.rsplit() for i in open(user_list,"wb")]
exchange_list=[i[8:] for i in os.listdir("TimeLine") if not i[0]=="."]
all_list=set(rand_list+exchange_list)
all_list.remove(CCAA.target)
all_list=list(all_list)
random.shuffle(all_list)
pick=[]
for i in all_list[:10]:
    i = clone.user_info(i)
    if not i is None:
        ids,name = i["id"],i["name"]
        print (name)
        pick+=clone.follow_exchanger(ids)
pick=[i for i in pick if not i in all_list]
random.shuffle(pick)
count=0
start_time=-1
for i in pick[:30]:
    ids=i
    print ("get ",ids ,"'s tweet")
    if start_time == -1:
        count=0
        start_time =time.time()
    words,num=textTools.create_train(ids,path="random_TimeLine/")
    count+=num

    if count >= 150:
        sleep_time = 900 - (time.time()-start_time) if 900 - (time.time()-start_time) > 0 else 0
예제 #2
0
# -*- coding: utf-8 -*-
"""指定ユーザーの相互フォロワーのツイートを取得
基本リプライとリツイートは含まない
簡単にbotは除く
"""

import clone
import pickle
import time
import textTools

ids=clone.target

his_list = clone.follow_exchanger(ids)
new_list=[[ids,clone.user_info(ids)["name"]]]
start_time=-1
count=0

print (len(his_list))
while his_list:
    infos=clone.users_info(his_list[:100])
    if start_time == -1:
        count=0
        start_time =time.time()
    count+=1
    for i in infos:
        if not "bot" in i["description"] and not i["protected"]:
            new_list.append([i["id_str"],i["name"]])

    his_list=his_list[100:]
    print "get ",count*100," follower"