Skip to content

Instantly share code, notes, and snippets.

@edsu
Last active January 26, 2021 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edsu/410c55b8f5aadb1bed9969d86c30b2a1 to your computer and use it in GitHub Desktop.
Save edsu/410c55b8f5aadb1bed9969d86c30b2a1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import json
import requests
results = []
url = "https://projects.propublica.org/politwoops/user/realDonaldTrump"
page = 0
while True:
page += 1
data = requests.get(url, params={"format": "json", "page": page}).json()
if len(data["tweets"]) == 0:
break
else:
results.extend(data['tweets'])
json.dump(results, open('trumpwoops.json', 'w'), indent=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment