Skip to content

Instantly share code, notes, and snippets.

@aqt
Created December 17, 2023 20:00
Show Gist options
  • Save aqt/e099617e8ba624840bf19619aba401ba to your computer and use it in GitHub Desktop.
Save aqt/e099617e8ba624840bf19619aba401ba to your computer and use it in GitHub Desktop.
Mark new entries, that are likely a youtube short, as read in Miniflux

Miniflux version 2.0.51

Youtube doesn't distinguish shorts from regular videos in their rss feed. The only way to know (without changes to Miniflux) is to enable FETCH_YOUTUBE_WATCH_TIME and filter out videos by duration. This does mean some videos may be caught in the crossfire, but in my case that's not very likely and it's an acceptable loss.

I know Miniflux recently added webhooks but I don't feel like reading into it, the API in general, and setting everything up. Less effort to just create a trigger.


Connect to the database and execute the following commands:

  1. Create table holding blocked channel feed ids
CREATE TABLE ytshorts_feed_id (
  feed_id bigint PRIMARY KEY
);
  1. Insert feed ids (go into a feed and copy the number from the URL)
INSERT INTO ytshorts_feed_id (feed_id) VALUES (1), (2), (3);
  1. Define the function that the trigger will call
CREATE OR REPLACE FUNCTION mark_shorts_as_read() RETURNS TRIGGER AS $$
BEGIN
  IF NEW.reading_time <= 1 AND EXISTS (SELECT 1 FROM ytshorts_feed_id WHERE feed_id = NEW.feed_id) THEN
    NEW.status = 'read';
  END IF;
  RETURN NEW;
END;
$$ LANGUAGE plpgsql;
  1. Create the trigger
CREATE TRIGGER mark_shorts_as_read_trigger
BEFORE INSERT ON entries
FOR EACH ROW
EXECUTE FUNCTION mark_shorts_as_read();

If you subscribe to a new channel just refer to step 2 to block that feed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment