如何从推文中获取 Twitter 用户名- PYTHON
how to get Twitter username from a tweet- PYTHON
我是 tweepy 的新手,我能够使用以下脚本从 Twitter 获取数据:
import tweepy
from tweepy import OAuthHandler
access_token="---------"
access_token_secret="----------"
consumer_key="---------"
consumer_secret="-------"
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
public_tweets = api.home_timeline()
print("public_tweets.text")
现在想要获取发推者的用户名以及获取的推文
示例:
"USERNAME":“------------推文------------”
提前致谢
public_tweets = api.home_timeline()
for tweet in public_tweets:
print('From :', tweet.user.screen_name, ', Text :', tweet.text)
我是 tweepy 的新手,我能够使用以下脚本从 Twitter 获取数据:
import tweepy
from tweepy import OAuthHandler
access_token="---------"
access_token_secret="----------"
consumer_key="---------"
consumer_secret="-------"
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
public_tweets = api.home_timeline()
print("public_tweets.text")
现在想要获取发推者的用户名以及获取的推文
示例:
"USERNAME":“------------推文------------”
提前致谢
public_tweets = api.home_timeline()
for tweet in public_tweets:
print('From :', tweet.user.screen_name, ', Text :', tweet.text)