Files
RSSHub/lib/v2/furstar/artists.js
NeverBehave 0792f7ba25 feat(core): first attempt to init script standard (#8224)
- lazy load
- rate limit per path
- init .debug.json support
- docs
- maintainer
- radar
2021-09-22 05:41:00 -07:00

33 lines
1.0 KiB
JavaScript

const utils = require('./utils');
const cheerio = require('cheerio');
const got = require('@/utils/got');
const dateParser = require('@/utils/dateParser');
module.exports = async (ctx) => {
const base = utils.langBase(ctx.params.lang);
const res = await got.get(base, {
https: {
rejectUnauthorized: false,
},
});
const $ = cheerio.load(res.data);
const artists = $('.filter-item')
.map((i, e) => utils.authorDetail(e))
.get();
artists.shift(); // the first one is "show all"
ctx.state.data = {
title: 'furstar 所有画家',
link: 'https://furstar.jp',
description: 'Furstar 所有画家列表',
language: ctx.params.lang,
item: artists.map((e) => ({
title: e.name,
author: e.name,
description: `<img src="${e.avatar}"/><a href="${base}/${e.link}">${e.name}</a>`,
pubDate: dateParser(new Date().toISOString()), // No Time for now
link: `${base}/${e.link}`,
})),
};
};