Skip to content

Commit

Permalink
Set output folder
Browse files Browse the repository at this point in the history
  • Loading branch information
PyGeek03 committed Jun 19, 2021
1 parent f6112ad commit a078bc3
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion get_100_last_retweets_twarc1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion get_conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion get_conversation_twarc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
11 changes: 6 additions & 5 deletions get_top_trending_tweets_twarc1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
11 changes: 6 additions & 5 deletions get_trends_twarc1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
4 changes: 2 additions & 2 deletions get_tweets_twarc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)

0 comments on commit a078bc3

Please sign in to comment.