fix: 适配网信办页面更新 (#12792)
This commit is contained in:
parent
22670d331f
commit
58ec314787
|
|
@ -19,8 +19,8 @@ module.exports = async (ctx) => {
|
|||
.toArray()
|
||||
.map((item) => {
|
||||
const href = $(item).attr('href');
|
||||
if (href && href.startsWith('http://www.cac.gov.cn/')) {
|
||||
const matchArray = href.match(/http:\/\/www\.cac\.gov\.cn(.*?)\/(A.*?\.htm)/);
|
||||
if (href && href.match(/(?:http:)?\/\/www\.cac\.gov\.cn(.*?)\/(A.*?\.htm)/)) {
|
||||
const matchArray = href.match(/(?:http:)?\/\/www\.cac\.gov\.cn(.*?)\/(A.*?\.htm)/);
|
||||
if (matchArray && matchArray.length > 2) {
|
||||
const path = matchArray[1];
|
||||
const htmlName = matchArray[2];
|
||||
|
|
@ -41,14 +41,14 @@ module.exports = async (ctx) => {
|
|||
const completeUrl = pathList.find((item) => item && item.path === path).completeUrl;
|
||||
const { data: channelResponse } = await got(completeUrl);
|
||||
const $1 = cheerio.load(channelResponse);
|
||||
const items = $1('li.clearfix')
|
||||
const items = $1('div#loadingInfoPage li')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
const c = $1(item);
|
||||
const a = c.find('a');
|
||||
const articleHref = a.attr('href');
|
||||
const title = a.text();
|
||||
const date = parseDate(c.find('span.times').text());
|
||||
const date = parseDate(c.find('.times').text());
|
||||
return {
|
||||
link: articleHref,
|
||||
pubDate: timezone(date),
|
||||
|
|
|
|||
Loading…
Reference in New Issue