fix(route): ccdi cookie should be called in await style (#10927)
* try to minic the js cookie behavior and bypass the anti spider * add more selector for diff article * regex polished * fix(route): cookie setting should be called in await
This commit is contained in:
parent
b0216ca3de
commit
6ee0d23892
|
|
@ -20,7 +20,7 @@ const parseCookie = async (body) => {
|
|||
const parseNewsList = async (url, selector, ctx) => {
|
||||
const response = await got(url, { cookieJar });
|
||||
const data = response.data;
|
||||
parseCookie(data);
|
||||
await parseCookie(data);
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $(selector)
|
||||
|
|
@ -44,7 +44,7 @@ const parseArticle = async (item, ctx) =>
|
|||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const response = await got(item.link, { cookieJar });
|
||||
const data = response.data;
|
||||
parseCookie(data);
|
||||
await parseCookie(data);
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const title = $('.daty, .source-box').text().trim();
|
||||
|
|
|
|||
Loading…
Reference in New Issue