summaryrefslogtreecommitdiff
path: root/remove-all.py
blob: 59ac73af73fd39376bf9351ff8bb4566741147d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python

# Usage:
#     remove-all.py <instance-url>

import miniflux
import subprocess
import sys

MINIFLUX_INSTANCE = sys.argv[1]
PASS_ENTRY = [x.decode('utf-8') for x in subprocess.check_output(['pass', 'self-hosted/miniflux/web']).splitlines()]
USER = [x for x in PASS_ENTRY if x.startswith("username:")][0].removeprefix("username:").strip()
SECRET = PASS_ENTRY[0]

try:
    client = miniflux.Client(MINIFLUX_INSTANCE, USER, SECRET)
except Exception as e: print(e)

print("client connected")
feeds = client.get_feeds()
print(f"got {len(feeds)} feeds")
for feed in feeds:
    try:
        id = feed['id']
        print(f"removing feed: {id}")
        client.delete_feed(id)
    except Exception as e: print(e)