如何在Python中基于推文id搜索推文



我得到了一个数据集,它只有像";1300747127350423552〃;,我可以在Python中搜索这些推文吗?我试过这个代码:

tweet=api.statuses_lookup([11300747127350423552'](a1[0].text

但它不起作用。

我可以搜索该ID并使用TWEEPY获得结果。出于隐私考虑,我不会发布结果。

import tweepy

def searchtweet():
twitter_auth_keys = {
"consumer_key": "yours goes here",
"consumer_secret": "yours goes here",
"access_token": "yours goes here",
"access_token_secret": "yours goes here"
}

auth = tweepy.OAuthHandler(
twitter_auth_keys['consumer_key'],
twitter_auth_keys['consumer_secret']
)
auth.set_access_token(
twitter_auth_keys['access_token'],
twitter_auth_keys['access_token_secret']
)
api = tweepy.API(auth)
print(api.statuses_lookup(["INSERT YOUR SEARCH TWEET ID HERE"]))
def main():
searchtweet()

最新更新