summaryrefslogtreecommitdiffstats
path: root/twitter/stream.py
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2014-10-24 12:16:51 -0400
committerThibaut Horel <thibaut.horel@gmail.com>2014-10-24 12:16:51 -0400
commitece1d828d53d6123fcecb5ea8bf9b126d1728ccc (patch)
treeb669382d0e5f1234556d1aeb7fa919891510b24d /twitter/stream.py
parent7426d8ff0e7969eb1a86bdb5bec8a0c971309e2b (diff)
downloadfast-seeding-ece1d828d53d6123fcecb5ea8bf9b126d1728ccc.tar.gz
Add code
Diffstat (limited to 'twitter/stream.py')
-rw-r--r--twitter/stream.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/twitter/stream.py b/twitter/stream.py
index 71cf615..4fe38c4 100644
--- a/twitter/stream.py
+++ b/twitter/stream.py
@@ -24,9 +24,7 @@ class Listener(StreamListener):
def get_concepts(self, entities):
hashtags = (hashtag["text"].lower()
for hashtag in entities["hashtags"])
- users = (user["screen_name"].lower()
- for user in entities["user_mentions"])
- return set(chain(hashtags, users))
+ return set(hashtags)
def on_status(self, tweet):
concepts = self.get_concepts(tweet.entities)
@@ -35,6 +33,7 @@ class Listener(StreamListener):
str(tweet.user.friends_count),
str(tweet.user.verified),
tweet.created_at.isoformat()])
+ print str(dict(tweet))
for concept in concepts:
if concept in self.fhandlers:
fh = self.fhandlers[concept]
@@ -47,7 +46,7 @@ def process(filename, cred_file):
concepts = [line.strip() for line in f]
credentials = open(cred_file).readline().strip().split()
os.chdir("data")
- entities = [("#" + concept, "@" + concept) for concept in concepts]
+ entities = [("#" + concept) for concept in concepts]
track = chain.from_iterable(entities)
auth = OAuthHandler(*credentials[2:4])
auth.set_access_token(*credentials[4:])