mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-29 18:06:31 +08:00
fix(route): Add missing first part of rattibha threads (#12633)
* fix(route): Add missing first part of rattibha threads Signed-off-by: Youssif Shaaban Alsager <ysh-alsager@hotmail.com> * fix(route): Use correct cache key for getting rattibha thread * fix(route): Cache item cottectly in rattibha thread --------- Signed-off-by: Youssif Shaaban Alsager <ysh-alsager@hotmail.com>
This commit is contained in:
@@ -21,15 +21,17 @@ module.exports = async (ctx) => {
|
||||
pubDate: parseDate(item.thread.created_at),
|
||||
updated: parseDate(item.thread.updated_at),
|
||||
author: userData.name,
|
||||
api_link: `${baseUrl}/threads?id=${item.thread_id}`,
|
||||
threadData1URL: `${baseUrl}/thread?id=${item.thread_id}`,
|
||||
threadData2URL: `${baseUrl}/threads?id=${item.thread_id}`,
|
||||
}));
|
||||
|
||||
// Get tweet full text
|
||||
const items = await Promise.all(
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.api_link, async () => {
|
||||
const { data: threads } = await got(item.api_link, { headers: { accept: 'application/json' } });
|
||||
item.description = threads.reduce((accumulator, tweet) => `${accumulator}${tweet.tweet_detail.info.text}<br>`, '');
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const { data: data1 } = await got(item.threadData1URL, { headers: { accept: 'application/json' } });
|
||||
const { data: data2 } = await got(item.threadData2URL, { headers: { accept: 'application/json' } });
|
||||
item.description = [...data1.tweets, ...data2].reduce((accumulator, tweet) => `${accumulator}${tweet.tweet_detail.info.text}<br>`, '');
|
||||
return item;
|
||||
})
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user