You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
424 B
18 lines
424 B
#!/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)
|
|
|