Skip to content

Instantly share code, notes, and snippets.

@WWelna
Created February 11, 2021 01:14
Show Gist options
  • Save WWelna/bea6242cce2ba8894d38eb6364d994cd to your computer and use it in GitHub Desktop.
Save WWelna/bea6242cce2ba8894d38eb6364d994cd to your computer and use it in GitHub Desktop.
Dump Gab from Redis to JSON
#!/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