Open d-kz opened 9 years ago
Here is some code that reads in tweets that makes the whole interaction smoother. "tweepy" does authorization stuff for us. We can probably find something similar for JS. Just for future reference
What do you mean reads in tweets? Doesnt our program already do this?
oh yeah, I just mean that we can avoid the weird interaction with twitter authorization and let some module handle it for us to make things smoother.
I mean we could write a short script to make us stop having to authorize it too, but yeah. I think I will look into hosting it soon
Ok sweet. let me know when you will! I want to get some more insight into marketing and how we could directly address the need with this.
!/usr/bin/python
from tweepy import Stream from tweepy import OAuthHandler from tweepy.streaming import StreamListener import pymongo from pymongo import MongoClient import datetime
import json
!! Things you care about, Denis
client = MongoClient() ##!! db = client['tweetdb'] ##!! collection = db['tweets'] ##!!
ckey = '9BISaQTrryl5V9wIOv56g' csecret = 'aJeiFLbIiYFk8sb4TVsraw6zqjoEParQcrcSpZzY6U' atoken = '2295205662-jOLHa9LbYXzsTpP61FXEVeRInpT6wVe01nK6HrW' asecret = '0UtCBtu59c8wwHSJeyAuHCs7agGeSFccKRth1FhrlVt8G'
class listener(StreamListener):
auth = OAuthHandler(ckey,csecret) auth.set_access_token(atoken, asecret) twitterStream = Stream(auth, listener()) common_filter = ['@','is','a','are','if','the','I','in','and'] twitterStream.filter(track=common_filter)