Files
RSSHub/lib/routes/furaffinity/watching.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

63 lines
1.8 KiB
TypeScript

import { Route } from '@/types';
import ofetch from '@/utils/ofetch';
export const route: Route = {
path: '/watching/:username',
name: `User's Watching List`,
url: 'furaffinity.net',
categories: ['social-media'],
example: '/furaffinity/watching/fender',
maintainers: ['TigerCubDen', 'SkyNetX007'],
parameters: { username: 'Username, can find in userpage' },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['furaffinity.net/watchlist/by/:username'],
target: '/watching/:username',
},
],
handler,
};
async function handler(ctx) {
const { username } = ctx.req.param();
const url = `https://faexport.spangle.org.uk/user/${username}/watching.json`;
const data = await ofetch(url, {
method: 'GET',
headers: {
Referer: 'https://faexport.spangle.org.uk/',
},
});
const urlUserInfo = `https://faexport.spangle.org.uk/user/${username}.json`;
const dataUserInfo = await ofetch(urlUserInfo, {
method: 'GET',
headers: {
Referer: 'https://faexport.spangle.org.uk/',
},
});
const watchingCount = dataUserInfo.watching.count;
const items = data.map((item) => ({
title: item,
link: `https://www.furaffinity.net/user/${item}`,
guid: item,
description: `${username} is watching ${item} <br> Total: ${watchingCount}`,
author: item,
}));
return {
title: `Fur Affinity | Users ${username} is watching`,
link: `https://www.furaffinity.net/watchlist/by/${username}/`,
description: `Fur Affinity Users ${username} is watching`,
item: items,
};
}