|
1 | 1 | import os
|
2 | 2 | import sys
|
3 | 3 | import json
|
4 |
| -import psycopg2 |
5 | 4 | from pprint import pprint
|
6 | 5 | from dateutil import parser
|
7 | 6 | from datetime import datetime
|
@@ -279,7 +278,6 @@ def get_ref_relations(tweets, ref_id2author_id, author_id2n_followers,
|
279 | 278 | tweet_id2ref_type2n_followers = dict()
|
280 | 279 | for tweet in tweets:
|
281 | 280 | tweet_id = tweet['id']
|
282 |
| - ref_id2ref_type = dict() |
283 | 281 | tweet_id2ref_type2author[tweet_id] = dict()
|
284 | 282 | tweet_id2ref_type2n_followers[tweet_id] = dict()
|
285 | 283 |
|
@@ -401,7 +399,7 @@ def get_tweet_insert(tweet, event, query_type, direct):
|
401 | 399 | 'directly_from_quote_search': False,
|
402 | 400 | 'from_timeline_search': False,
|
403 | 401 | 'directly_from_timeline_search': False,
|
404 |
| - 'text': tweet['text'], |
| 402 | + 'text': tweet['text'].replace('\x00', ''), |
405 | 403 | 'lang': tweet['lang'],
|
406 | 404 | 'author_id': tweet['author_id'],
|
407 | 405 | 'created_at': parser.parse(tweet['created_at']),
|
@@ -498,7 +496,7 @@ def get_user_insert(user, event):
|
498 | 496 |
|
499 | 497 | for f in ['description', 'location', 'pinned_tweet_id']:
|
500 | 498 | try:
|
501 |
| - user_insert[f] = user[f] |
| 499 | + user_insert[f] = user[f].replace('\x00', '') |
502 | 500 | except KeyError:
|
503 | 501 | user_insert[f] = None
|
504 | 502 |
|
|
0 commit comments