mirror of
https://git.mia.jetzt/scrubber
synced 2024-11-21 13:07:25 -07:00
34 lines
770 B
Python
34 lines
770 B
Python
|
from pathlib import Path
|
||
|
|
||
|
import httpx
|
||
|
import psycopg
|
||
|
|
||
|
from com import eval_config, parse_graph, progressbar
|
||
|
|
||
|
config = eval_config()
|
||
|
conn: psycopg.Connection = config["connect"]()
|
||
|
token: str = config["token"]
|
||
|
api: str = config["api"]
|
||
|
|
||
|
graph = parse_graph()
|
||
|
print("reading filterlist")
|
||
|
filtered = Path("filtered.list").read_text().strip().splitlines()
|
||
|
|
||
|
queue = []
|
||
|
|
||
|
def enqueue(note):
|
||
|
for reply in note["replies"]:
|
||
|
enqueue(graph[reply])
|
||
|
for quote in note["quotes"]:
|
||
|
enqueue(graph[quote])
|
||
|
if "self" in note["flags"]:
|
||
|
files = conn.execute('select "fileIds" from note where id = %s', [note["id"]]).fetchone()[0]
|
||
|
queue.append((note["id"], files))
|
||
|
|
||
|
for id in filtered:
|
||
|
enqueue(graph[id])
|
||
|
|
||
|
print(queue)
|
||
|
|
||
|
# client = httpx.Client()
|