mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-13 00:35:57 +08:00
* feat(route): add Bandcamp Weekly * refactor: migrate to v2 * docs: fix route tag Co-authored-by: TonyRL <TonyRL@users.noreply.github.com>
30 lines
849 B
JavaScript
30 lines
849 B
JavaScript
const got = require('@/utils/got');
|
|
const { parseDate } = require('@/utils/parse-date');
|
|
const { art } = require('@/utils/render');
|
|
const path = require('path');
|
|
|
|
module.exports = async (ctx) => {
|
|
const rootUrl = 'https://bandcamp.com';
|
|
const apiUrl = `${rootUrl}/api/bcweekly/3/list`;
|
|
const response = await got({
|
|
method: 'get',
|
|
url: apiUrl,
|
|
});
|
|
|
|
const items = response.data.results.slice(0, 50).map((item) => ({
|
|
title: item.title,
|
|
link: `${rootUrl}/?show=${item.id}`,
|
|
pubDate: parseDate(item.published_date),
|
|
description: art(path.join(__dirname, 'templates/weekly.art'), {
|
|
v2_image_id: item.v2_image_id,
|
|
desc: item.desc,
|
|
}),
|
|
}));
|
|
|
|
ctx.state.data = {
|
|
title: 'Bandcamp Weekly',
|
|
link: rootUrl,
|
|
item: items,
|
|
};
|
|
};
|