Beispiel #1
0
def main():

    connection = get_db("teenspirit")

    # Get unique user id from tweets
    users = get_distinct_users(connection=connection)

    # Insert all users in users db
    query = map(lambda x: {"user_id": x, "controls": []}, users)

    add_to_mongo(query, collection="users", connection=connection)
 def run(self, params):
     search = params.get("search", None)
     if not search:
         raise Exception("Search not provide.")
     tweets = [x.AsDict() for x in getTweetFromHashTag(search, self.api)]
     [add_to_mongo(x) if not is_exists(x["id"]) else None for x in tweets]
     return 0
    def run(self, params):
        user = params.get("user", None)
        if not user:
            raise Exception("User id not provide.")

        tweets = [x.AsDict() for x in userTimeline(user, self.api, rec=1)]
        [add_to_mongo(x) if not is_exists(x["id"]) else None for x in tweets]
        return 0
Beispiel #4
0
def main(user_id, api):
    tweets = map(lambda x: x.AsDict(), userTimeline(user_id, api, rec=1))
    print tweets[0]
    map(lambda x: add_to_mongo(x) if not is_exists(x["id"]) else None, tweets)
    return 0
def main(search, api):
    tweets = map(lambda x: x.AsDict(), getTweetFromHashTag(search, api))
    map(lambda x: add_to_mongo(x) if not is_exists(x["id"]) else None, tweets)
    return 0