コード例 #1
0
ファイル: region.py プロジェクト: juicyJ/citybeat_online
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
コード例 #2
0
ファイル: test4.py プロジェクト: juicyJ/citybeat_online
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