fix(route): headers in got usage (#9363)

This commit is contained in:
Tony 2022-03-22 15:19:20 +00:00 committed by GitHub
parent 95789aafaa
commit c7cb516321
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 25 additions and 25 deletions

View File

@ -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,
},
});

View File

@ -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,
},
});

View File

@ -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,
},
});

View File

@ -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,

View File

@ -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,
},
});

View File

@ -11,7 +11,7 @@ module.exports = {
const response = await got({
method: 'get',
url: currentUrl,
header: {
headers: {
Referer: rootUrl,
},
});

View File

@ -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}` : ''),
},
});

View File

@ -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,
},
});

View File

@ -7,7 +7,7 @@ module.exports = async (ctx) => {
const response = await got({
url: baseUrl + '/' + category,
header: {
headers: {
Referer: baseUrl,
},
});

View File

@ -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`,
},
});

View File

@ -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(),
});

View File

@ -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',
},
});

View File

@ -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,
},
});

View File

@ -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,
},
});