diff --git a/lib/twitter/__pycache__/tweet_converter.cpython-37.pyc b/lib/twitter/__pycache__/tweet_converter.cpython-37.pyc index 733061c..8f1b0bd 100644 Binary files a/lib/twitter/__pycache__/tweet_converter.cpython-37.pyc and b/lib/twitter/__pycache__/tweet_converter.cpython-37.pyc differ diff --git a/lib/twitter/tweet_converter.py b/lib/twitter/tweet_converter.py index be6a3f3..4e4d9de 100644 --- a/lib/twitter/tweet_converter.py +++ b/lib/twitter/tweet_converter.py @@ -14,7 +14,8 @@ def convert_tweets(tweets): 'retweet':('RT @' in tweet.text), 'text':str(tweet.text.encode('utf-8'))[1:], 'hashtags':tweet.entities.get('hashtags'), - 'mentions':tweet.entities.get('user_metions') + 'mentions':tweet.entities.get('user_metions'), + 'reply':(tweet.in_reply_to_status_id_str) }) except: @@ -25,7 +26,8 @@ def convert_tweets(tweets): 'retweet':('RT @' in tweet.full_text), 'text':str(tweet.full_text.encode('utf-8'))[1:], 'hashtags':tweet.entities.get('hashtags'), - 'mentions':tweet.entities.get('user_metions') + 'mentions':tweet.entities.get('user_metions'), + 'reply':(tweet.in_reply_to_status_id_str) }) except: @@ -35,7 +37,8 @@ def convert_tweets(tweets): 'retweet':True, 'text':str(tweet.retweeted_status.text.encode("utf-8"))[1:], 'hashtags':tweet.entities.get('hashtags'), - 'mentions':tweet.entities.get('user_metions') + 'mentions':tweet.entities.get('user_metions'), + 'reply':(tweet.in_reply_to_status_id_str) }) return outtweets \ No newline at end of file diff --git a/tweet_echoer.py b/tweet_echoer.py index caef23e..9a08b15 100644 --- a/tweet_echoer.py +++ b/tweet_echoer.py @@ -85,13 +85,13 @@ def echo_recent_tweets(screen_name): language=None, idempotency_key=None) ''' - - mastodon.status_post( - t['text'][1:-1], - visibility='public', - spoiler_text='Twitter Echo, I\'m not on Masto rn.' - ) - print(t['date'] + '\t' + t['text']) + if((not t['reply']) and (not t['retweet'])): + mastodon.status_post( + t['text'][1:-1], + visibility='public', + spoiler_text='Twitter Echo, I\'m not on Masto rn.' + ) + print(t['date'] + '\t' + t['text']) sleep(30) fresh_start = False @@ -100,16 +100,4 @@ def echo_recent_tweets(screen_name): if __name__ == '__main__': with open('users.txt', 'r') as f: for l in f: - echo_recent_tweets(l.rstrip()) - -# Clean these up - -''' -#write the csv -with open('%s_tweets.csv' % screen_name, 'w') as f: - writer = csv.writer(f) - writer.writerow(["id","created_at","retweet","text","hashtags","user_mentions"]) - writer.writerows(outtweets) - -pass -''' + echo_recent_tweets(l.rstrip()) \ No newline at end of file