Commit 21cd3864 authored by Rémy Decoupes's avatar Rémy Decoupes
Browse files

change output format to jsonl : json lines

parent e621a60f
#### Twitter Credentials ####
params/credentials.py
#### tweets ####
output/tweetoutput.json
output/tweetoutput.jsonl
#### Log ####
log/collectweets.log
#### libreoffice back up ####
......
......@@ -60,7 +60,7 @@ class Listener(tweepy.StreamListener):
self.logger.info("initiate stream listener")
def on_status(self, status):
print(status.text, file=self.output_file)
print(status._json, file=self.output_file)
def on_error(self, status_code):
logger.error("Error on stream twiter: "+str(status_code))
......@@ -100,7 +100,7 @@ if __name__ == '__main__':
accounttofollowedlist = list(map(str, accounttofollowedlist))
# Start a Twitter stream
tweetouputfilename = "output/tweetoutput.json"
tweetouputfilename = "output/tweetoutput.jsonl"
tweetoutput = open(tweetouputfilename, 'w')
myStreamListener = Listener(tweetoutput, logger)
stream = tweepy.Stream(auth=api.auth, listener=myStreamListener)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment