修复 OSChina 可能采集到相对链接的问题 (#1986)
This commit is contained in:
parent
5de618fc88
commit
da8fbb6744
|
|
@ -1,3 +1,4 @@
|
|||
const url = require('url');
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
|
|
@ -58,7 +59,7 @@ module.exports = async (ctx) => {
|
|||
const item = {
|
||||
title: each.find('a', 'h3').attr('title'),
|
||||
description: each.find('p', '.description').text(),
|
||||
link: encodeURI(originalUrl),
|
||||
link: url.resolve('https://www.oschina.net', encodeURI(originalUrl)),
|
||||
};
|
||||
if (/^https?:\/\/www.oschina.net\/news\/.*$/.test(originalUrl)) {
|
||||
const key = 'oschina' + item.link;
|
||||
|
|
|
|||
Loading…
Reference in New Issue