Generate feeds from URL and selectors.
Add this line to your application's Gemfile:
gem 'weneedfeed'
And then execute:
bundle install
Or install it yourself as:
gem install weneedfeed
Weneedfeed requires weneedfeed.yml
that describes URLs and selectors.
title: Example RSS feeds
pages:
- id: example1
title: Example 1
description: Example feed with CSS Selector
url: http://example.com/1
item_selector: li
item_description_selector: p:nth-child(3)
item_image_selector: img
item_link_selector: a
item_time_selector: time
item_title_selector: p:nth-child(2)
- id: example2
title: Example 2
description: Example feed with XPath
url: http://example.com/2
item_selector: //li
item_image_selector: .//img
item_description_selector: .//p[3]
item_link_selector: .//a
item_time_selector: .//time
item_title_selector: .//p[2]
- optional (default:
"Weneedfeed"
) - Used for feeds title on top page and OPML outline.
Feed ID.
- required
- Used for feed URL and
<link>
element in<channel>
element.
Feed title.
- required
- Used for RSS
<title>
element in<channel>
element.
Feed description.
- optional
- Used for RSS
<description>
element in<channel>
element.
HTML source URL.
- required
- Used to fetch HTML page for building feed.
CSS or XPath selector to search each item.
- required
- Equivalent unit to RSS
<item>
element.
CSS or XPath selector to find <a>
element in each item.
- required
- Used for
<link>
in<item>
.
CSS or XPath selector to find element with title information in each item.
- required
- Used for
<title>
in<item>
.
CSS or XPath selector to find element with description information in each item.
- optional
- Used for
<description>
in<item>
.
CSS or XPath selector to find <img>
element in each item.
- optional
- Used for
<enclosure>
in<item>
.
CSS or XPath selector to find element with datetime information in each item.
- optional
- Used for
<pubDate>
in<item>
. Itsdatetime
attribute or its inner HTML is used to calculate datetime.
Run weneedfeed build
to build static files.
Usage:
weneedfeed build --base-url=BASE_URL
Options:
--base-url=BASE_URL # Base URL where to locate built files. (e.g. `"https://user.github.io/repo"`)
[--schema-path=SCHEMA_PATH] # Path to weneedfeed YAML schema file.
# Default: weneedfeed.yml
Build static files.
Run weneedfeed server
to run HTTP server.
Usage:
weneedfeed server
Options:
[--schema-path=SCHEMA_PATH] # Path to weneedfeed YAML schema file.
# Default: weneedfeed.yml
[--port=PORT] # TCP port to bind to.
# Default: 8080
Run HTTP server.
Use weneedfeed-action for invoking weneedfeed on GitHub Actions.