Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
umr-tetis
MOOD
mood-tetis-tweets-collect
Commits
21cd3864
Commit
21cd3864
authored
Jun 09, 2020
by
Rémy Decoupes
Browse files
change output format to jsonl : json lines
parent
e621a60f
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
21cd3864
#### Twitter Credentials ####
params/credentials.py
#### tweets ####
output/tweetoutput.json
output/tweetoutput.json
l
#### Log ####
log/collectweets.log
#### libreoffice back up ####
...
...
collectTweets.py
View file @
21cd3864
...
...
@@ -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.json
l
"
tweetoutput
=
open
(
tweetouputfilename
,
'w'
)
myStreamListener
=
Listener
(
tweetoutput
,
logger
)
stream
=
tweepy
.
Stream
(
auth
=
api
.
auth
,
listener
=
myStreamListener
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment