fix(route): headers in got usage (#9363)
This commit is contained in:
parent
95789aafaa
commit
c7cb516321
|
|
@ -23,7 +23,7 @@ module.exports = async (ctx) => {
|
|||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: host,
|
||||
},
|
||||
});
|
||||
|
|
@ -51,7 +51,7 @@ module.exports = async (ctx) => {
|
|||
const response = await got({
|
||||
method: 'get',
|
||||
url: itemUrl,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: host,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ module.exports = async (ctx) => {
|
|||
const response = await got({
|
||||
method: 'get',
|
||||
url: baseUrl + cat.link,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: baseUrl,
|
||||
},
|
||||
});
|
||||
|
|
@ -86,7 +86,7 @@ module.exports = async (ctx) => {
|
|||
const article = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: cat.link,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ module.exports = async (ctx) => {
|
|||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: host,
|
||||
},
|
||||
});
|
||||
|
|
@ -77,7 +77,7 @@ module.exports = async (ctx) => {
|
|||
const response = await got({
|
||||
method: 'get',
|
||||
url: itemUrl,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: host,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ module.exports = async (ctx) => {
|
|||
method: 'post',
|
||||
url: rootUrl,
|
||||
cookieJar,
|
||||
header: {
|
||||
headers: {
|
||||
referer: 'https://www.telecompaper.com/international/news/mobile',
|
||||
},
|
||||
body: form,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module.exports = async (ctx) => {
|
|||
const topResponse = await got({
|
||||
method: 'get',
|
||||
url,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: 'https://www.zcool.com.cn',
|
||||
},
|
||||
});
|
||||
|
|
@ -20,7 +20,7 @@ module.exports = async (ctx) => {
|
|||
const articleResponse = await got({
|
||||
method: 'get',
|
||||
url: 'https://www.zcool.com.cn/top/article.do?rankType=8&rankId=' + rankId,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: url,
|
||||
},
|
||||
});
|
||||
|
|
@ -56,7 +56,7 @@ module.exports = async (ctx) => {
|
|||
const itemResponse = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: url,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ module.exports = {
|
|||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: rootUrl,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const response = await got({
|
||||
url: baseUrl + '/posts' + (category ? `/${category}` : ''),
|
||||
header: {
|
||||
headers: {
|
||||
Referer: baseUrl,
|
||||
},
|
||||
});
|
||||
|
|
@ -33,7 +33,7 @@ module.exports = async (ctx) => {
|
|||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
url: item.link,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: baseUrl + '/posts/' + (category ? `/${category}` : ''),
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const response = await got({
|
||||
url: baseUrl + '/topic/' + topic,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: baseUrl,
|
||||
},
|
||||
});
|
||||
|
|
@ -33,7 +33,7 @@ module.exports = async (ctx) => {
|
|||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
url: item.link,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: baseUrl + '/topic/' + topic,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const response = await got({
|
||||
url: baseUrl + '/' + category,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: baseUrl,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ module.exports = async (ctx) => {
|
|||
const resp = await got({
|
||||
method: 'get',
|
||||
url: cat.link,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: `http://www.cbirc.gov.cn`,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const response = await got({
|
||||
url: baseUrl + '/breaches',
|
||||
header: {
|
||||
headers: {
|
||||
Referer: baseUrl,
|
||||
},
|
||||
});
|
||||
|
|
@ -32,14 +32,14 @@ module.exports = async (ctx) => {
|
|||
async () => {
|
||||
const article = await got({
|
||||
url: item.link,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: baseUrl + '/breaches',
|
||||
},
|
||||
});
|
||||
const content = cheerio.load(article.body);
|
||||
|
||||
item.description = art(path.join(__dirname, 'templates/description.art'), {
|
||||
header: content('#breach-detail').html(),
|
||||
headers: content('#breach-detail').html(),
|
||||
overview: content('section.detail-section.jst-cntr.flx.flx-col').html(),
|
||||
dataClasses: content('section.detail-section.bg-white.jst-cntr.flx.flx-col').html(),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module.exports = async (ctx) => {
|
|||
const rootUrl = `https://forum.gamer.com.tw/A.php?bsn=${ctx.params.bsn}`;
|
||||
const response = await got({
|
||||
url: rootUrl,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: 'https://forum.gamer.com.tw',
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ module.exports = async (ctx) => {
|
|||
const response = await got({
|
||||
method: 'get',
|
||||
url: baseUrl + cat.link,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: baseUrl,
|
||||
},
|
||||
});
|
||||
|
|
@ -99,7 +99,7 @@ module.exports = async (ctx) => {
|
|||
const article = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: cat.link,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ module.exports = async (ctx) => {
|
|||
const response = await got({
|
||||
method: 'get',
|
||||
url: baseUrl + '/' + category,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: 'https://www.hket.com',
|
||||
},
|
||||
});
|
||||
|
|
@ -54,7 +54,7 @@ module.exports = async (ctx) => {
|
|||
const article = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
header: {
|
||||
headers: {
|
||||
Referer: baseUrl + '/' + category,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue