Created
February 11, 2021 01:14
-
-
Save WWelna/bea6242cce2ba8894d38eb6364d994cd to your computer and use it in GitHub Desktop.
Dump Gab from Redis to JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
import redis | |
r = redis.Redis() | |
print("LOADING...") | |
k = r.keys("GABPOST*") | |
print("SORTING...") | |
y = [] | |
for x in k: | |
y.append(int(x[7:])) | |
y.sort() | |
del k | |
k = y | |
print("DUMPING...") | |
with open("gab_posts.json", 'w') as f: | |
for x in k: | |
d = r.get("GABPOST"+str(x)) | |
f.write(d.decode('utf-8')+"\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment