Files
RSSHub/lib/v2/lxixsxa/information.js
T
69cd00d1a4 feat(route): add LiSA (#10755)
* feat(route): add LiSA

* Add a linebreak before next heading

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* fix title

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* use art-template

* fix docs link

* rename folder

* fix router url according to new folder name

* fix router path & example path in doc

* append radar detectable source

* Update lib/v2/lxixsxa/templates/disco.art

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Update lib/v2/lxixsxa/templates/info.art

Co-authored-by: Weijian Li <ri1ken@r1ks-mba.local>
2022-09-10 20:49:43 +08:00

49 lines
1.5 KiB
JavaScript

const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
const { parseJSONP } = require('./jsonpHelper');
const { art } = require('@/utils/render');
const path = require('path');
module.exports = async (ctx) => {
const api = 'https://www.sonymusic.co.jp/json/v2/artist/lisa/information/start/0/count/-1';
const url = 'https://www.sonymusic.co.jp/artist/lisa/info';
const title = 'NEWS';
const response = await got({
method: 'get',
url: api,
});
const data = parseJSONP(response.data).items.map((item) => ({
id: item.id,
title: item.title,
category: item.category,
date: item.date,
description: item.article,
}));
ctx.state.data = {
// the source title
title,
// the source url
link: url,
// the source description
description: "Let's see what is new about LiSA.",
// iterate through all leaf objects
item: data.map((item) => ({
// the article title
title: item.title,
// the article content
description: art(path.join(__dirname, 'templates/info.art'), {
category: item.category,
description: item.description.replace(/\n/g, '<br>'),
}),
// the article publish time
pubDate: parseDate(item.date),
// the article link
link: `${url}/${item.id}`,
})),
};
};