Skip to content

Instantly share code, notes, and snippets.

@ckuethe
Created October 13, 2025 17:30
Show Gist options
  • Select an option

  • Save ckuethe/231a529519d829f580679ddcc4eb04e9 to your computer and use it in GitHub Desktop.

Select an option

Save ckuethe/231a529519d829f580679ddcc4eb04e9 to your computer and use it in GitHub Desktop.
Examples of using the Miniflux API

Cleaning your Miniflux

Import the necessary modules

from miniflux import Client
from collections import Counter
from keyring import get_password

# No creds in code.
nr = Client("https://miniflux.example.com", "exampleuser", get_password("miniflux", "miniflux_exampleuser"))

You'll need to know the list of categories to filter:

categories = {x["title"]: x["id"] for x in nr.get_categories()}
print(categories)

This is how to look for common tags

def find_common_tags(
    client,
    category: int,
    *,
    n: int = 500,
    feed_id: int = None,
    search: str = None,
    tag: str = None,
    order_by: str = "published_at",
    direction: str = "desc",
):
    """
    Get a list of common tags which might help you bulk dismiss uninteresting tags.

    n:int - count this many articles
    feed_id:int - limit counting to just the specified feed
    search:str - text to search for when counting. Docs are lacking, experiment to see what works for you
    tag:str - limit counting to articles with the specified tag
    order_by:str - which field to sort by. 'published_at' is most useful for me
    direction:str - sort direction. basically, I'm looking at the most recent articles
    """
    all_tags = []  # set()
    rv = Counter()
    articles = nr.get_category_entries(
        category_id=category,
        direction=direction,
        order=order_by,
        limit=n,
        starred=False,
        status="unread",
        feed_id=feed_id,
        search=search,
        tags=tag,
    )
    for x in articles["entries"]:
        if x["tags"]:
            rv.update(x["tags"])

    return rv


for c in find_common_tags(nr, categories["News"], feed_id=None, search=None, tag=None).most_common(50):
    print(f"{c[1]} {c[0]}")

Let's find some articles

filter_tags = [
    "Pokemon",
    "Cookies",
    "cars",
    "shopping",
]

filter_articles = [] # going to delete these

for t in filter_tags:
    articles = nr.get_category_entries(
        category_id=categories["News"],
        direction="desc",
        order="published_at",
        limit=500,
        starred=False, # Use stars for stuff I want to keep
        status="unread",
        tags=t,
        # feed_id=35, # feed number goes here
        # search="something", # search text goes here
    )
    if az["entries"]:
        filter_articles.extend(articles["entries"])

# If you want to look at what you're about to dismiss
print([(x["id"], f"{x['feed']['title']} // {x['title']}", x["tags"]) for x in filter_articles])

Set the read/unread status on the articles

to_state = "read" # or "unread"

# you can mark articles individually
for a in filter_articles:
    nr.update_entries([a["id"]], to_state)

# or you can mark in bulk
nr.update_entries([x["id"] for x in filter_articles], to_state)

Processing an individual article.

# retrieve the article, doesn't change status to "read"
article = nr.get_entry(123456)

# up to you to define what is uninteresting. Keywords, length, regex, feed it to an LLM..
if article_is_uninteresting(article['content'):
    nr.update_entries([article['id']], "read")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment