From 33c24050a7a8619edf9d58509dc56f88c7880832 Mon Sep 17 00:00:00 2001 From: Terry Liao <jinliang@student.unimelb.edu.au> Date: Sun, 12 May 2019 21:16:38 +1000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3import=E8=AF=AD=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tweet_havester/tweepy_search.py | 4 ++-- tweet_havester/tweepy_stream.py | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tweet_havester/tweepy_search.py b/tweet_havester/tweepy_search.py index 7ebdb8a..fe18c6b 100644 --- a/tweet_havester/tweepy_search.py +++ b/tweet_havester/tweepy_search.py @@ -5,7 +5,7 @@ import couchdb import tweepy from tweepy import OAuthHandler from sklearn.externals import joblib - +import general_process as gp class TweetSearchHavester(): @@ -43,7 +43,6 @@ class TweetSearchHavester(): process_db = self.couch['tweet_results'] for tweet in tweepy.Cursor(api.user_timeline,id = user_id ).items(50): # save most recent tweets - gp = GP() dic = {} dic['_id'] = tweet.id_str dic['create_time'] = str(tweet.created_at) @@ -57,6 +56,7 @@ class TweetSearchHavester(): # print(dic) try: p_dic = gp.data_process(dic,self.model) + print(p_dic) if p_dic != None: process_db.save(p_dic) db.save(dic) diff --git a/tweet_havester/tweepy_stream.py b/tweet_havester/tweepy_stream.py index 7f3b438..c2abc3b 100644 --- a/tweet_havester/tweepy_stream.py +++ b/tweet_havester/tweepy_stream.py @@ -8,7 +8,7 @@ from tweepy import OAuthHandler from tweepy import Stream from tweepy.streaming import StreamListener from sklearn.externals import joblib -import general_process as GP +import general_process as gp class listener(StreamListener): def __init__(self,path): @@ -28,7 +28,6 @@ class listener(StreamListener): return dic def on_data(self,data): try: - gp = GP() db = self.couch['raw_tweets'] id_db = self.couch['user_id'] pc_db = self.couch['tweet_results'] @@ -38,7 +37,6 @@ class listener(StreamListener): # print(id_doc) p_dic = gp.data_process(dic,self.model) if p_dic != None: - process_db.save(p_dic) id_db.save(id_doc) db.save(dic) -- GitLab