|
|
|
@ -14,6 +14,13 @@ from .twi_parser import parse_timeline
|
|
|
|
|
|
|
|
|
|
|
|
LATEST_TWEET_ID_DICT = {}
|
|
|
|
LATEST_TWEET_ID_DICT = {}
|
|
|
|
LATEST_TWEET_TS_DICT = {}
|
|
|
|
LATEST_TWEET_TS_DICT = {}
|
|
|
|
|
|
|
|
def mark_skip_trans(tweet):
|
|
|
|
|
|
|
|
tweet["skip_trans"] = True
|
|
|
|
|
|
|
|
for key in ("quoted", "retweeted"):
|
|
|
|
|
|
|
|
sub = tweet.get(key)
|
|
|
|
|
|
|
|
if sub:
|
|
|
|
|
|
|
|
mark_skip_trans(sub)
|
|
|
|
|
|
|
|
|
|
|
|
def check_new_tweets(tweets, list_id, check_interval=600):
|
|
|
|
def check_new_tweets(tweets, list_id, check_interval=600):
|
|
|
|
if not tweets: return []
|
|
|
|
if not tweets: return []
|
|
|
|
new_tweets = []
|
|
|
|
new_tweets = []
|
|
|
|
@ -53,6 +60,9 @@ async def task_handler(args):
|
|
|
|
tweets = parse_timeline(data)
|
|
|
|
tweets = parse_timeline(data)
|
|
|
|
new_tweets = check_new_tweets(tweets, list_id, config.get("check_interval", 600))
|
|
|
|
new_tweets = check_new_tweets(tweets, list_id, config.get("check_interval", 600))
|
|
|
|
new_tweets = filter_tweets(new_tweets, args["filter"])
|
|
|
|
new_tweets = filter_tweets(new_tweets, args["filter"])
|
|
|
|
|
|
|
|
if args.get("skip_trans"):
|
|
|
|
|
|
|
|
for tweet in new_tweets:
|
|
|
|
|
|
|
|
mark_skip_trans(tweet)
|
|
|
|
if new_tweets:
|
|
|
|
if new_tweets:
|
|
|
|
json_data = { args["qq"]: new_tweets }
|
|
|
|
json_data = { args["qq"]: new_tweets }
|
|
|
|
logger.info("\n" + pprint.pformat(json_data))
|
|
|
|
logger.info("\n" + pprint.pformat(json_data))
|
|
|
|
|