我有一个Twitter用户名列表,我使用以下代码从每个用户中检索100条推文:
account_list = list(['altgeldshrugged', 'colsonwhitehead',
'NickKristof', 'ayeletw', 'Bourdain'])
data = []
for i in account_list:
tweets = api.user_timeline(screen_name=i, count=100, include_rts=False)
print("Number of tweets extracted: {}.\n".format(len(tweets)))
for t in tweets:
data.append(t.text)
newdata = pd.DataFrame(np.array(data).reshape(100, 13), columns=account_list)
但是,每位用户100条推文包含转发。当我使用过滤器'include_rts = False'时,结果将类似于:
Number of tweets extracted: 90.
Number of tweets extracted: 26.
Number of tweets extracted: 96.
Number of tweets extracted: 42.
Number of tweets extracted: 32.
如何修改脚本,以便获得100条推文(不包括推文)?