Commit 1dc35d7b authored by Rémy Decoupes's avatar Rémy Decoupes
Browse files

filter by keywords OR accounts

parent d4254730
......@@ -101,8 +101,11 @@ if __name__ == '__main__':
# Get twitter ID of account
accounttofollowed = pd.read_csv("params/accountsFollowed.csv")
accounttofollowedlist = accounttofollowed['twitterID'].tolist()
accounttofollowedlist = list(map(str, accounttofollowedlist))
accounttofollowedlist = list(map(str,accounttofollowed['twitterID'].tolist()))
# Get hashtag to track
hashtagtracked = pd.read_csv("params/keywordsFilter.csv")
hashtagtrackedList = list(map(str, hashtagtracked['hashtags'].tolist()))
# Start a Twitter stream
timestr = time.strftime("%Y%m%d-%H%M%S")
......@@ -112,7 +115,7 @@ if __name__ == '__main__':
stream = tweepy.Stream(auth=api.auth, listener=myStreamListener)
try:
logger.info("Start streaming")
stream.filter(follow=accounttofollowedlist)
stream.filter(follow=accounttofollowedlist, track=hashtagtrackedList)
except KeyboardInterrupt as e:
logger.info("Stream Keyboard Interrupt")
finally:
......
hashtags,disease,add_date
coronavirus,covid19,2020-06-11
covid-19,covid19,2020-06-11
covid19,covid19,2020-06-11
ncov,covid19,2020-06-11
2019-ncov,covid19,2020-06-11
n-cov2019,covid19,2020-06-11
ncov2019,covid19,2020-06-11
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