mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-18 22:32:10 +08:00
d82847f541
* style: prefer object shorthand syntax * refactor: prefer Array#map over Array#forEach * style: prefer arrow callback * chore(eslint): update rules * style: auto fix by eslint
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
const got = require('@/utils/got');
|
|
const cheerio = require('cheerio');
|
|
|
|
module.exports = async (ctx) => {
|
|
const link = `https://repo.xposed.info/module/${ctx.params.mod}`;
|
|
const response = await got({
|
|
method: 'get',
|
|
url: link,
|
|
});
|
|
|
|
const data = response.data;
|
|
|
|
const $ = cheerio.load(data);
|
|
const title = $('#page-title').text();
|
|
const list = $('div.field-collection-view');
|
|
|
|
ctx.state.data = {
|
|
title: `${title}(${ctx.params.mod}) 更新`,
|
|
link,
|
|
item:
|
|
list &&
|
|
list
|
|
.map((_, item) => {
|
|
item = $(item);
|
|
const version = item.find('div.field-name-field-version-number div.even').text();
|
|
return {
|
|
title: `Version ${version}`,
|
|
description: item.find('div.field-name-field-changes').html(),
|
|
link,
|
|
pubDate: item.find('span.date-display-single').html().replace('- ', ''),
|
|
guid: ctx.params.mod + version,
|
|
};
|
|
})
|
|
.get(),
|
|
};
|
|
};
|