Esempio n. 1
0
 def on_data(self, raw_data):
     if raw_data is None:
         mylog.error(
             "Tweepy says raw_data=None.  Wat.  Dropping tweet, or whatever it was."
         )
         return
     return StreamListener.on_data(self, raw_data)
Esempio n. 2
0
 def on_data(self, data):
     jsonData = json.loads(data)
     text1 = jsonData['text']
     text2 = jsonData['entities']['hashtags']
     #Change the file name if different files are needed.
     f1 = open('./tweetFile1.txt', 'ab')
     a = csv.writer(f1, delimiter=',')
     print(text1)
     a.writerow([str(text1.encode('utf-8'))])
     return StreamListener.on_data(self, data)
Esempio n. 3
0
 def on_data(self, data):
     jsonData = json.loads(data)
     text1 = jsonData['text']
     text2 = jsonData['entities']['hashtags']
     for hashtag in text2:
         text2 = hashtag['text']
         print text2, ":", text1
         f1 = open('./tweetFile_superBOWL6.csv', 'ab')
         a = csv.writer(f1, delimiter=',')
         a.writerow([
             "UJG123469",
             str(text2.encode('utf-8')),
             str(text1.encode('utf-8'))
         ])
     return StreamListener.on_data(self, data)
Esempio n. 4
0
 def on_data(self, raw_data):
     if raw_data is None:
         mylog.error("Tweepy says raw_data=None.  Wat.  Dropping tweet, or whatever it was.")
         return
     return StreamListener.on_data(self, raw_data)