feat: add zaker channel (#2550)

* feat: add zaker channel

* feat: add zaker channel

* feat: add zaker channel
This commit is contained in:
Cloud
2019-07-04 16:28:26 +08:00
committed by DIYgod
parent bb63129d50
commit 062e6bce81
3 changed files with 11 additions and 3 deletions

View File

@@ -3,8 +3,9 @@ const cheerio = require('cheerio');
const date_util = require('@/utils/date');
module.exports = async (ctx) => {
const type = ctx.params.type || 'source';
const id = ctx.params.id;
const link = `http://www.myzaker.com/source/${id}`;
const link = `http://www.myzaker.com/${type}/${id}`;
const response = await got.get(link);
const $ = cheerio.load(response.data);
@@ -40,10 +41,13 @@ module.exports = async (ctx) => {
method: 'get',
headers: {
Referer: link,
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0',
},
});
const $ = cheerio.load(response.data);
$('img').each((index, elem) => {
const $elem = $(elem);
$elem.attr('referrerpolicy', 'no-referrer');
});
const description = $('div.article_content div')
.html()
.replace(/data-original/g, `src`);