'Tweepy streamer not capturing full tweet text
I am currently scraping tweets via Tweepy into a mySQL database. I am new to routing data into a server, so I am having trouble adjusting my code to get the extended version of a tweet. Here's the code for reference:
class listener(StreamListener):
def on_data(self, data):
all_data = json.loads(data)
tweet = all_data["text"]
username = all_data["user"]["screen_name"]
c.execute("INSERT INTO MSQL4 (time, username, tweet) VALUES (%s,%s,%s)",
(time.time(), username, tweet))
conn.commit()
print((username,tweet))
return True
def on_error(self, status):
print(status)
I am sure I just need to insert a command somewhere in the function. Any advice would be greatly appreciated.
For reference, the code above is not my own creation-- I pulled this code from a tutorial a week ago. All credit to the original author for the code.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|