Spaces:
Sleeping
Sleeping
Delete journalist.py
Browse files- journalist.py +0 -17
journalist.py
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
import zipfile, json, os, time
|
| 2 |
-
|
| 3 |
-
def journalist_export(results, out_path):
|
| 4 |
-
index = []
|
| 5 |
-
with zipfile.ZipFile(out_path, "w", zipfile.ZIP_DEFLATED) as z:
|
| 6 |
-
for i,r in enumerate(results):
|
| 7 |
-
meta = {
|
| 8 |
-
"source": r.get("source"),
|
| 9 |
-
"url": r.get("url"),
|
| 10 |
-
"snippet": r.get("snippet"),
|
| 11 |
-
"timestamp": time.time()
|
| 12 |
-
}
|
| 13 |
-
name = f"doc_{i}.json"
|
| 14 |
-
z.writestr(name, json.dumps(meta, indent=2))
|
| 15 |
-
index.append(meta)
|
| 16 |
-
z.writestr("INDEX.json", json.dumps(index, indent=2))
|
| 17 |
-
return out_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|