Files
RSSHub/lib/routes/furaffinity/journal-comments.ts
T
SkyNetX007 72d9c0ec91 feat(route/furaffinity): Add routes for furaffinity as a substitute for deprecated routes (#17314)
* feat(route): Init furaffinity namespace, add status route

* feat(route): Add browse, home, search, user routes for FA

* fix(route): fix wrong url in search route

* feat(route): Add gallery, scraps, favorites as art route for furaffinity

* style: fix example url of art route

* feat(route): Add watcher,watching route

* feat(route): Add shouts, journals, commissions route

* fix(route): Allow empty gallery and search result

* style: Follow eslint rules

* style: Fix UNUSED_VAR_ASSIGN

* Fixes issues based on review feedback

* Remove deprecated furaffinity routes

* Update lib/routes/furaffinity/commissions.ts

* Update lib/routes/furaffinity/namespace.ts

---------
2024-11-12 01:53:21 +08:00

65 lines
1.9 KiB
TypeScript

import { Route } from '@/types';
import ofetch from '@/utils/ofetch';
export const route: Route = {
path: '/journal-comments/:id',
name: 'Journal Comments',
url: 'furaffinity.net',
categories: ['social-media'],
example: '/furaffinity/journal-comments/10925112',
maintainers: ['TigerCubDen', 'SkyNetX007'],
parameters: { id: 'Journal ID' },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['furaffinity.net/journal/:id'],
target: '/journal-comments/:id',
},
],
handler,
};
async function handler(ctx) {
const { id } = ctx.req.param();
const urlJournal = `https://faexport.spangle.org.uk/journal/${id}.json`;
const urlComments = `https://faexport.spangle.org.uk/journal/${id}/comments.json`;
const dataJournal = await ofetch(urlJournal, {
method: 'GET',
headers: {
Referer: 'https://faexport.spangle.org.uk/',
},
});
const dataComments = await ofetch(urlComments, {
method: 'GET',
headers: {
Referer: 'https://faexport.spangle.org.uk/',
},
});
const items = dataComments.map((item) => ({
title: item.text,
link: `https://www.furaffinity.net/journal/${id}`,
guid: item.id,
description: `<img src="${item.avatar}"> <br> ${item.name}: ${item.text}`,
pubDate: new Date(item.posted_at).toUTCString(),
author: item.name,
}));
return {
allowEmpty: true,
title: `${dataJournal.title} - ${dataJournal.name} | Journal Comments`,
link: `https://www.furaffinity.net/journal/${id}`,
description: `Fur Affinity | ${dataJournal.title} by ${dataJournal.name} - Journal Comments`,
item: items,
};
}