1
0
mirror of https://github.com/zedeus/nitter.git synced 2025-12-08 04:55:37 -05:00

Support RSS feeds for custom searches

Fixes #45
This commit is contained in:
Zed
2019-09-28 03:22:46 +02:00
parent 6d61c203cf
commit 61991a9b56
3 changed files with 69 additions and 37 deletions

View File

@@ -19,6 +19,17 @@ template respRss*(rss: typed) =
proc createRssRouter*(cfg: Config) =
router rss:
get "/search/rss":
if @"text".len > 200:
resp Http400, showError("Search input too long.", cfg.title)
let query = initQuery(params(request))
if query.kind != custom:
resp Http400, showError("Only Tweet searches are allowed for RSS feeds.", cfg.title)
let tweets = await getSearch[Tweet](query, "", getAgent())
respRss(renderSearchRss(tweets.content, query.text, genQueryUrl(query)))
get "/@name/rss":
cond '.' notin @"name"
respRss(await showRss(@"name", Query()))