trump-vocabulary/bootstrap.py

19 lines
424 B
Python

#!/usr/bin/env python3
import json
import zipfile
from pathlib import Path
def load_archive(path):
with zipfile.ZipFile(str(path), "r") as archive:
json_data = archive.read(path.stem)
return json.loads(json_data)
tweets = []
for archive_path in Path("trump_tweet_data_archive/").iterdir():
if not archive_path.match("condensed_*.json.zip"):
continue
tweets += load_archive(archive_path)