Filter,Rewrite_and_Scraper_Rules

Filtering Rules 

Miniflux has a basic filtering system that allows you to ignore or keep
articles.

Block Rules

Block rules ignore articles with a title that match the regex.

For example, the regex (?i)miniflux will ignore all articles with a
title that contains the word Miniflux (case insensitive).

Ignored articles won’t be saved into the database.

Keep Rules

Keep rules keeps only articles that matches the regex.

For example, the regex (?i)miniflux will keep only the articles with a
title that contains the word Miniflux (case insensitive).

Rewrite Rules 

To improve the reading experience, it’s possible to alter the content of
feed items.

For example, if you are reading a popular comic website
like [XKCD]{.ul}, it’s nice to have the image title
(the alt attribute) added under the image. Especially on mobile devices
where there is no hover event.

add_dynamic_image

Tries to add the highest quality images from sites that use JavaScript
to load images (e.g. either lazily when scrolling or based on screen
size).

add_image_title

Add each image’s title as a caption under the image.

add_youtube_video

Insert Youtube video to the article (automatic for Youtube.com).

add_invidious_video

Insert Invidious player to the article (automatic for
https://invidio.us).

add_youtube_video_using_invidious_player

Insert Invidious player to the article for Youtube feeds.

add_mailto_subject

Insert mailto links subject into the article.

nl2br

Convert new lines n to 
 (useful for non-HTML contents).

convert_text_links

Convert text link to HTML links (useful for non-HTML contents).

fix_medium_images

Attempt to fix Medium’s images rendered in Javascript.

use_noscript_figure_images

Use 

replace(“search term”|”replace term”)

Search and replace text.

Miniflux includes a set of default rules for some websites, but you
could define your own rules.

On the feed edit page, enter your custom rules in the field “Rewrite
Rules” like this:

rule1,rule2

Separate each rule by a comma.

Scraper Rules 

When an article contains only an extract of the content, you could
fetch the original web page and apply a set of rules to get relevant
contents.

Miniflux uses CSS selectors for custom rules. These custom rules can
be saved in the feed properties (Select a feed and click on edit).


CSS Selector Description


div#articleBody Fetch a div element with the ID articleBody

div.content Fetch all div elements with the class content

article, div.article Use a comma to define multiple rules

Miniflux includes a list of predefined rules for popular websites. You
could contribute to the project to keep them up to date.

Under the hood, Miniflux uses the
library [Goquery]{.ul}.


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!