mirror of
https://github.com/zedeus/nitter
synced 2026-09-06 15:19:32 +00:00
Optimize RSS requests by disabling media fetching
This commit is contained in:
parent
453beff09d
commit
6fb039dd79
5 changed files with 21 additions and 18 deletions
|
|
@ -9,7 +9,9 @@ import ../views/general
|
|||
include "../views/rss.nimf"
|
||||
|
||||
proc showRss*(name, hostname: string; query: Query): Future[string] {.async.} =
|
||||
let (profile, timeline, _) = await fetchSingleTimeline(name, "", getAgent(), query)
|
||||
let (profile, timeline, _) =
|
||||
await fetchSingleTimeline(name, "", getAgent(), query, media=false)
|
||||
|
||||
if timeline != nil:
|
||||
return renderTimelineRss(timeline, profile, hostname)
|
||||
|
||||
|
|
@ -28,7 +30,7 @@ proc createRssRouter*(cfg: Config) =
|
|||
if query.kind != tweets:
|
||||
resp Http400, showError("Only Tweet searches are allowed for RSS feeds.", cfg)
|
||||
|
||||
let tweets = await getSearch[Tweet](query, "", getAgent())
|
||||
let tweets = await getSearch[Tweet](query, "", getAgent(), media=false)
|
||||
respRss(renderSearchRss(tweets.content, query.text, genQueryUrl(query), cfg.hostname))
|
||||
|
||||
get "/@name/rss":
|
||||
|
|
@ -49,5 +51,5 @@ proc createRssRouter*(cfg: Config) =
|
|||
|
||||
get "/@name/lists/@list/rss":
|
||||
cond '.' notin @"name"
|
||||
let list = await getListTimeline(@"name", @"list", getAgent(), "")
|
||||
let list = await getListTimeline(@"name", @"list", getAgent(), "", media=false)
|
||||
respRss(renderListRss(list.content, @"name", @"list", cfg.hostname))
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ export profile, timeline, status
|
|||
|
||||
type ProfileTimeline = (Profile, Timeline, seq[GalleryPhoto])
|
||||
|
||||
proc fetchSingleTimeline*(name, after, agent: string;
|
||||
query: Query): Future[ProfileTimeline] {.async.} =
|
||||
proc fetchSingleTimeline*(name, after, agent: string; query: Query;
|
||||
media=true): Future[ProfileTimeline] {.async.} =
|
||||
let railFut = getPhotoRail(name, agent)
|
||||
|
||||
var timeline: Timeline
|
||||
|
|
@ -26,12 +26,12 @@ proc fetchSingleTimeline*(name, after, agent: string;
|
|||
|
||||
if query.kind == posts:
|
||||
if cachedProfile.isSome:
|
||||
timeline = await getTimeline(name, after, agent)
|
||||
timeline = await getTimeline(name, after, agent, media)
|
||||
else:
|
||||
(profile, timeline) = await getProfileAndTimeline(name, agent, after)
|
||||
(profile, timeline) = await getProfileAndTimeline(name, agent, after, media)
|
||||
cache(profile)
|
||||
else:
|
||||
var timelineFut = getSearch[Tweet](query, after, agent)
|
||||
var timelineFut = getSearch[Tweet](query, after, agent, media)
|
||||
if cachedProfile.isNone:
|
||||
profile = await getCachedProfile(name, agent)
|
||||
timeline = await timelineFut
|
||||
|
|
|
|||
Loading…
Reference in a new issue