refactor: Stats gov, change the img href from relative href to absolute href for better rss reading experiences. (#10875)
* add new statsgov * Fix radar.js * 1. Fix the missing optional chaining operator in reg matching 2. add the missing timezone change * remove the dup $ in item * optimize url * stats.gov.cn refactored * Modify doc * more flexible pathname parsing * Fix radar data * change image src to absolute src * more accurate comment.
This commit is contained in:
parent
9b9f0c4ad0
commit
7fdffa9133
|
|
@ -33,6 +33,15 @@ const parseXilan = async (item, ctx) =>
|
|||
const title = $('.xilan_titf').text();
|
||||
item.author = title.match(/来源:(.*)发布时间/)?.[1].trim() ?? '国家统计局';
|
||||
item.pubDate = timezone(parseDate(title.match(/发布时间:(.*)/)?.[1].trim() ?? item.pubDate), +8);
|
||||
|
||||
// Change the img src from relative to absolute for a better compatibility
|
||||
$('.xilan_con')
|
||||
.find('img')
|
||||
.each((_, el) => {
|
||||
$(el).attr('src', new URL($(el).attr('src'), item.link).href);
|
||||
// oldsrc is causing freshrss imageproxy not to work correctly
|
||||
$(el).removeAttr('oldsrc').removeAttr('alt');
|
||||
});
|
||||
item.description = $('.xilan_con').html();
|
||||
|
||||
const attachmentTitle = $('.wenzhang_tit').filter(function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue