Skip to content

Commit

Permalink
fix: 适配网信办页面更新 (#12792)
Browse files Browse the repository at this point in the history
  • Loading branch information
drgnchan committed Jul 13, 2023
1 parent 22670d3 commit 58ec314
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/v2/gov/cac/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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),
Expand Down

0 comments on commit 58ec314

Please sign in to comment.