【发布时间】:2020-10-05 13:29:31
【问题描述】:
现在行 status.text 正在获取推文文本,但它被截断(不是完整的推文文本)。如何在获取推文信息时使用 on status 获取推文全文?
def on_status(self, status):
if not hasattr(status,'retweeted_status'):
#db = DatabaseInteractor.DatabaseInteractor()
text=self.parse_text(status.text)
created_at=self.parse_text(status.created_at)
user_id=self.parse_text(status.user.id_str)
username=self.parse_text(status.user.name)
location=self.parse_text(status.user.location)
coordinates=self.parse_text(status.coordinates)
tweet_id=self.parse_text(status.id_str)
hashtags=self.parse_text(status.entities['hashtags'])
print("Created At: " + created_at)
print("Tweet Text: " + text)
print("Tweet ID: " + tweet_id)
print("Username: " + username)
print("Username ID: " + user_id)
print("Location: " + location )
print("Coordinates: " + coordinates)
print("Hashtags: " + hashtags)
【问题讨论】:
标签: json python-3.x twitter tweepy