mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-10-04 05:37:10 +00:00
Add feed discovery plugin
This commit is contained in:
parent
e47616bf9d
commit
5cfeea6b57
37 changed files with 2432 additions and 5 deletions
22
plugins/feed-discovery/src/output/json-feed.ts
Normal file
22
plugins/feed-discovery/src/output/json-feed.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import type { FeedDiscoveryResponse } from "../types.js";
|
||||
|
||||
export function renderJsonFeed(response: FeedDiscoveryResponse) {
|
||||
return JSON.stringify(
|
||||
{
|
||||
version: "https://jsonfeed.org/version/1.1",
|
||||
title: `LogicSRC feed discovery: ${response.query}`,
|
||||
home_page_url: "https://bittorrented.com/rss",
|
||||
feed_url: `https://bittorrented.com/json-feed/discover/${encodeURIComponent(response.normalizedQuery)}.json`,
|
||||
items: response.results.map((result) => ({
|
||||
id: result.canonicalFeedUrl ?? result.feedUrl,
|
||||
url: result.homepageUrl ?? result.feedUrl,
|
||||
title: result.title,
|
||||
summary: result.description ?? `Discovered ${result.kind} feed from ${result.provider}`,
|
||||
date_published: result.lastPublishedAt,
|
||||
tags: [result.kind, result.provider, ...result.tags]
|
||||
}))
|
||||
},
|
||||
null,
|
||||
2
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue