]> git.mxchange.org Git - fba.git/blob - preload_db.py
removed fuck up
[fba.git] / preload_db.py
1 import sqlite3
2 from hashlib import sha256
3
4 conn = sqlite3.connect("blocks_default.db")
5 c = conn.cursor()
6
7 with open("pleroma_instances.txt", "r") as f:
8     while line := f.readline():
9         print(line.rstrip(), sha256(bytes(line.rstrip(), "utf-8")).hexdigest())
10         c.execute(f"insert into instances select \"{line.rstrip()}\", \"{sha256(bytes(line.rstrip(), 'utf-8')).hexdigest()}\"")
11         conn.commit()
12
13 with open("mastodon_instances.txt", "r") as f:
14     while line := f.readline():
15         print(line.rstrip(), sha256(bytes(line.rstrip(), "utf-8")).hexdigest())
16         c.execute(f"insert into instances select \"{line.rstrip()}\", \"{sha256(bytes(line.rstrip(), 'utf-8')).hexdigest()}\"")
17         conn.commit()