fix: 得到首页 (#6187)
This commit is contained in:
parent
7113ad0ce9
commit
a31510e4db
|
|
@ -9,13 +9,19 @@ module.exports = async (ctx) => {
|
|||
url: rootUrl,
|
||||
});
|
||||
|
||||
const currentUrl = `${rootUrl}${response.data.match(new RegExp('<a href="(.*)">' + caty + '<\\/a>'))[1]}`;
|
||||
const listUrl = `${rootUrl}${response.data.match(new RegExp('<a href="(.*)">年度日更<\\/a>'))[1]}`;
|
||||
const listResponse = await got({
|
||||
method: 'get',
|
||||
url: listUrl,
|
||||
});
|
||||
|
||||
const currentUrl = `${rootUrl}${listResponse.data.match(new RegExp('<span>' + caty + '<\\/span><a href="(.*)" rel="tag"><\\/a>'))[1].split('"')[0]}`;
|
||||
const currentResponse = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(listResponse.data);
|
||||
const $ = cheerio.load(currentResponse.data);
|
||||
|
||||
const list = $('.pro-info p a')
|
||||
.slice(0, 10)
|
||||
|
|
|
|||
Loading…
Reference in New Issue