GithubHelp home page GithubHelp logo

systemz / rss-funnel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shouya/rss-funnel

0.0 0.0 0.0 195 KB

An RSS multi-tool

License: GNU General Public License v3.0

Shell 0.97% Rust 97.71% Makefile 1.31%

rss-funnel's Introduction

RSS Funnel

The RSS Funnel is a modular RSS processing pipeline. It is designed to be used to modify existing RSS source in various interesting ways such as:

  • Fetch full content
  • Generate a RSS feed from an HTML page
  • Remove unwanted elements from the article (using a CSS selector)
  • Keep or remove articles matching keywords or patterns
  • Highlight keywords in articles
  • rich DOM manipulation on the feed
  • Redact or replace text in the article (using a regular expression)
  • Split a single RSS article into multiple articles
  • Run arbitrary JS code to transform the article

Installation

You can use the docker image (latest version) in your docker-compose.yaml:

version: "3.8"
services:
  rss-funnel:
    image: ghcr.io/shouya/rss-funnel:latest
    ports:
      - 4080:4080
    volumes:
      - ./funnel.yaml:/funnel.yaml
    command: /rss-funnel -c /funnel.yaml server

Alternatively, you can build it directly from source:

git clone https://github.com/shouya/rss-funnel.git
cd rss-funnel
cargo build --release

Usage

To use rss-funnel, you need to supply a configuration file in YAML. Here is an example configuration.

endpoints:
  - path: /tokio-blog.xml
    note: Full text of Tokio blog
    source: https://tokio.rs/_next/static/feed.xml
    filters:
      - full_text: {}
      - simplify_html: {}

  - path: /solidot.xml
    note: Solidot news with links
    source: https://www.solidot.org/index.rss
    filters:
      - full_text: {}
      - keep_element: .p_mainnew
      - simplify_html: {}
      - sanitize:
          - replace_regex:
              from: "(?<link>http(s)?://[^< \n]*)"
              to: '<a href="$link">$link</a>'

  - path: /hackernews.xml
    note: Full text of Hacker News
    source: https://news.ycombinator.com/rss
    filters:
      - full_text:
          simplify: true
          append_mode: true

Save above file to /path/to/funnel.yaml and run the following command:

rss-funnel -c /path/to/funnel.yaml server

You can optionally specify the bind address and port (default 127.0.0.1:4080). Detailed usage can be found in --help output.

The endpoints like http://127.0.0.1:4080/tokio-blog.xml should be serving the filtered feeds.

Endpoint

Each of the configuration contains a number of endpoints. Each endpoint correspond to a RSS feed.

Properties:

  • path (required): The path of the endpoint. The path should start with /.
  • note (optional): A note for the endpoint. Only used for display purpose.
  • source (optional): The source url of the RSS feed.
    • If not specified, you must specify ?source=<url> query in the request. This allows for usages like applying same filters for different feeds.
    • If the source points to a HTML page, rss-funnel will try to generate a RSS feed from the page with a single article. You can then use split filter to split the single article into multiple articles. See Cookbook: Hacker News Top Links for an example.
  • filters (required): A list of filters to apply to the feed.
    • The feed from the source goes through the filters in the order specified. You can think of each filter as corresponding to a transformation on the Feed.
    • Each filter is specified as an YAML object with the singleton key being the name of the filter and the value being the configuration of the filter.
      • For example, in the filter definition: - keep_element: .p_mainnew
        • the filter’s name is keep_element
        • the configuration is the string value .p_mainnew. Depending on the filter, the configuration can have different types.
    • The Feed object from the last filter is returned as the response.
  • client (optional): The configuration for the HTTP client used to fetch the source like the user_agent. See Client config for detail.

Filters

See Filters for the documentations for all available filters.

Cookbook

See Cookbook for some examples of using rss-funnel.

rss-funnel's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.