Beispiel #1
0
 def update_user_by_crawled_info(self, user):
     id = user["id_str"]
     if not user["location"] == None:
         location_property = util.mysqlescape(user["location"])
     else:
         location_property = ""
     name = util.mysqlescape(user["name"])
     query = (
         "UPDATE users SET screen_name = '%s', location_property = '%s', name = '%s', profile_crawled = 1 WHERE id = %s"
         % (user["screen_name"], location_property, name, id)
     )
     self.issue_insert(query.encode("utf-8"))
Beispiel #2
0
 def insert_tweet(self, tweet, q):
     id = tweet["id_str"]
     text = util.mysqlescape(tweet["text"])
     user_id = tweet["from_user_id_str"]
     timestamp = util.mysqldatetimeformat(tweet["created_at"])
     q = util.mysqlescape(q).decode("UTF-8")
     query = "INSERT INTO tweets(id, text, user_id, timestamp, query) VALUES(%s, '%s', %s, '%s', '%s')" % (
         id,
         text,
         user_id,
         timestamp,
         q,
     )
     self.issue_insert(query.encode("utf8"))
Beispiel #3
0
 def insert_location(self, location):
     query = "INSERT INTO locations VALUES (%s, '%s', %s, %s)" % (
         location["id"],
         util.mysqlescape(location["name"]),
         location["lat"],
         location["long"],
     )
     self.issue_insert(query.encode("utf-8"))