From a078bc376999fdc7cec90ee6c48dd1ca0d7a6a34 Mon Sep 17 00:00:00 2001 From: PyGeek03 Date: Sat, 19 Jun 2021 16:16:37 +0930 Subject: [PATCH] Set output folder --- get_100_last_retweets_twarc1.py | 2 +- get_conversation.py | 2 +- get_conversation_twarc2.py | 2 +- get_top_trending_tweets_twarc1.py | 11 ++++++----- get_trends_twarc1.py | 11 ++++++----- get_tweets_twarc2.py | 4 ++-- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/get_100_last_retweets_twarc1.py b/get_100_last_retweets_twarc1.py index 15349aa..af46197 100644 --- a/get_100_last_retweets_twarc1.py +++ b/get_100_last_retweets_twarc1.py @@ -22,5 +22,5 @@ filename = input("Filename to output to: ") if filename == "": filename = "retweets_cache" -with open(f'{filename}.json', 'w') as f: +with open(f'outputs/{filename}.json', 'w') as f: f.writelines(serialized_json) \ No newline at end of file diff --git a/get_conversation.py b/get_conversation.py index c639292..34fc1e6 100644 --- a/get_conversation.py +++ b/get_conversation.py @@ -116,7 +116,7 @@ def main(): filename = input("Filename to write to: ") if filename == "": filename = "conversation_cache" - with open(f'{filename}.json', 'w') as f: + with open(f'outputs/{filename}.json', 'w') as f: f.writelines(serialized_json) # print(serialized_json) diff --git a/get_conversation_twarc2.py b/get_conversation_twarc2.py index de47a47..45f9818 100644 --- a/get_conversation_twarc2.py +++ b/get_conversation_twarc2.py @@ -28,5 +28,5 @@ filename = input("Filename to output to: ") if filename == "": filename = "conversation_cache" -with open(f'{filename}.json', 'w') as f: +with open(f'outputs/{filename}.json', 'w') as f: f.writelines(serialized_json) \ No newline at end of file diff --git a/get_top_trending_tweets_twarc1.py b/get_top_trending_tweets_twarc1.py index dfbd2d0..8814000 100644 --- a/get_top_trending_tweets_twarc1.py +++ b/get_top_trending_tweets_twarc1.py @@ -13,10 +13,11 @@ access_token, access_token_secret) location_codes = { - 'world': 1, - 'US': 23424977 - } -chosen_location = 'US' + 'Global': 1, + 'US': 23424977, + 'AU': 60370 +} +chosen_location = 'Global' trends = client1.trends_place(location_codes[chosen_location])[0]["trends"] for i in range(len(trends)): if trends[i]["tweet_volume"] is None: @@ -31,5 +32,5 @@ filename = input("Filename to output to: ") if filename == "": filename = "trending_tweets_cache" -with open(f'{filename}.json', 'w') as f: +with open(f'outputs/{filename}.json', 'w') as f: f.writelines(serialized_json) diff --git a/get_trends_twarc1.py b/get_trends_twarc1.py index 9578037..81285bf 100644 --- a/get_trends_twarc1.py +++ b/get_trends_twarc1.py @@ -13,10 +13,11 @@ access_token, access_token_secret) location_codes = { - 'world': 1, - 'US': 23424977 - } -chosen_location = 'US' + 'Global': 1, + 'US': 23424977, + 'AU': 60370 +} +chosen_location = 'Global' trends = client1.trends_place(location_codes[chosen_location])[0]["trends"] for i in range(len(trends)): if trends[i]["tweet_volume"] is None: @@ -31,5 +32,5 @@ filename = input("Filename to output to: ") if filename == "": filename = "trends_cache" -with open(f'{filename}.json', 'w') as f: +with open(f'outputs/{filename}.json', 'w') as f: f.writelines(serialized_json) diff --git a/get_tweets_twarc2.py b/get_tweets_twarc2.py index 5940cba..62cf078 100644 --- a/get_tweets_twarc2.py +++ b/get_tweets_twarc2.py @@ -12,7 +12,7 @@ tweet_ids = tweets_input.split() data = [] -for response in client2.tweet_lookup(tweet_ids): +for response in client2.user_lookup(tweet_ids): data.extend(response['data']) serialized_json = json.dumps(data, @@ -23,5 +23,5 @@ filename = input("Filename to output to: ") if filename == "": filename = "tweets_cache" -with open(f'{filename}.json', 'w') as f: +with open(f'outputs/{filename}.json', 'w') as f: f.writelines(serialized_json) \ No newline at end of file