-
Notifications
You must be signed in to change notification settings - Fork 4
Cookbook
shouya edited this page Jul 8, 2024
·
14 revisions
filters:
- remove_element:
- 'img[src$=".gif"]'
- ".ad, .banner"
- path: /hn-best.xml
source: https://news.ycombinator.com/best
note: Hacker News Top Links
filters:
- split:
title_selector: ".titleline > a"
link_selector: ".titleline > a"
description_selector: "tr.athing + tr"
- path: /inspect.xml
note: Utility for inspecting RSS feeds
filters:
- modify_post: post.content = `<pre>${JSON.stringify(post, null, 2)}</pre>`;
Note you need to supply ?source=http://your-domain.com/feed.xml
in the query string if you omit the source
field in the endpoint definition.
filters:
- magnet: {}
- path: /reddit-comments.xml
source: https://www.reddit.com/r/selfhosted.rss
filters:
- modify_post: |
// load comment from old reddit pages
post.links[0].href = post.links[0].href.replace(/www\.reddit\.com/, "old.reddit.com");
- full_text:
append_mode: true
keep_element: .nestedlisting.sitetable
- remove_element:
# the list of buttons like "permalink", "embed", etc.
- ".flat-list.buttons"
# the vote buttons
- ".midcol.unvoted"
# the expand "[+]" button
- ".expand"
# deleted comments
- ".deleted.comment"
- modify_post: |
const dom = DOM.parse_document(post.content.value);
for (const comment of dom.select("form.usertext")) {
comment.set_outer_html(comment.inner_text());
}
post.content.value = dom.to_html();
Note that you can leave out the source
field and supply any reddit's official rss via the ?source=
parameter. e.g. http://example.com/reddit-comments.xml?source=https://old.reddit.com/r/selfhosted/top/.rss.
https://github.com/ajayyy/DeArrow is a crowdsourced database providing de-clickbait-ed YouTube title and thumbnail. The following config demonstrate the use of fetch
API in modify_post
to replace the YouTube feed's title and thumbnail.
- path: /kurtzgesagt-dearrow.xml
source: https://www.youtube.com/feeds/videos.xml?channel_id=UCsXVk37bltHxD1rDPwtNM8Q
filters:
- modify_post: |
const video_id = post.id.split(':').pop(); // video id is the last segment of the post's id
const resp = await fetch(`https://sponsor.ajay.app/api/branding?videoID=${video_id}`);
if (resp.status != 200) return;
// update the title
const [{title}] = resp.json().titles;
post.title.value = title;
// update the thumbnail
const thumbnail = post.extensions.media.group.filter(g => g.name == 'media:group')[0].children.thumbnail[0];
thumbnail.attrs.url = `https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${video_id}`;
- path: /kurtzgesagt-dearrow.xml
source: https://www.youtube.com/feeds/videos.xml?channel_id=UCsXVk37bltHxD1rDPwtNM8Q
filters:
- modify_post: |
if (post.title.value.includes('#shorts')) {
return null;
}
- path: /rss-tool-releases.xml
note: Merging multiple feeds into one
source:
format: rss
title: RSS Tool Releases
description: An aggregated feed of releases from various projects
filters:
- merge:
source:
- /github-release.xml?source=https://github.com/shouya/rss-funnel/releases
- /github-release.xml?source=https://github.com/RSS-Bridge/rss-bridge/releases
- convert_to: atom
- merge:
- https://selfh.st/releases/feed/latest/project/yarr.xml
- https://selfh.st/releases/feed/latest/project/miniflux.xml