使用 Tweeppy PYTHON 过滤搜索的转推

2024-04-18 11:26:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图用用户的评论(如果有)来显示用户的转发,但是当我保持文本文件格式时,显示如下:

Status(contributors=None, truncated=False, text=u'de Anahi con @atwn #Qun', is_quote_status=False, in_reply_to_status_id=None, id=6624564125782016L, favorite_count=0, api=, author=User(followrequest_sent=False, has_extended_profile=True, profile_use_background_image=True, json={u'followrequest_sent': False, u'has_extended_profile': True, u'profile_use_background_image': True, u'default_profile_image': False, u'id': 148061558, u'profile_background_image_url_https': u'https://pbs.twimg.com/profile_background_images/624758616149504/NZ68rSC.jpg', u'verified': False, u'profile_text_color': u'333333', u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/66245414768646632/4YmbieuO_normal.jpg', u'profile_sidebar_fill_color': u'EFEFEF', u'entities': {u'description': {u'urls': []}}, u'followers_count': 2763, u'profile_sidebar_border_color': u'FFFFFF', u'id_str': u'14801558',

当然,它是更广泛的,不知道他们是否可以帮助显示,只有我需要的是谁被转发,有多少追随者,它的人等其他人。 它显示了,但正如我所说,显示了所有这些,并不需要它。你知道吗

我在这里留下了一些代码:

api = tweepy.API(auth)
hasht=api.search(buscar_term)
data = api.get_user(username)
for datos in hasht:
guardar=datos.split(',')
archivo= codecs.open('archivo.txt','a')
archivo.write(str(datos))
archivo.close()
print("\n")
print("\n")
print("\n")
print("\n")
print("\n")
print("\n")
print(("Hashtags and Retweets"), str(hasht))

谢谢。你知道吗


Tags: 用户httpsimageapiidfalsetrueprofile