Beispiel #1
0
def checkTweetInRegion():
    region = {}
    region['min_lat'] = InstagramConfig.photo_min_lat
    region['max_lat'] = InstagramConfig.photo_max_lat
    region['min_lng'] = InstagramConfig.photo_min_lng
    region['max_lng'] = InstagramConfig.photo_max_lng

    r = Region(region)

    ti = TweetInterface()
    ti.setDB('citybeat_production')
    ti.setCollection('tweets')
    cur = ti.getAllDocuments()
    tot = 0
    tweet_in_region = 0
    for tweet in cur:
        cor = [0, 0]
        cor[0] = tweet['location']['latitude']
        cor[1] = tweet['location']['longitude']
        tot += 1
        if r.insideRegion(cor):
            tweet_in_region += 1

    print tweet_in_region
    print tot
Beispiel #2
0
def main():
    ti = TweetInterface()
    ti.setDB('citybeat_production')
    ti.setCollection('tweets')
    tc = ti.getAllDocuments({'created_time' : {'$gte' : '1378711668'}})
    print tc.count()
    cnt = 0
    for tweet in tc:
        tweet = Tweet(tweet)
        text = tweet.getText().lower()
        if 'quinn' in text:
            print text
            cnt += 1
    print cnt