NeoNomadeN
Apify & Crawlee3y ago
15 replies
NeoNomade

cookies help

Hello,
I've done first the experiment in postman. Visit a page, take the cookies from there, go to another page ( that required those cookies ) and it worked.
I'm trying to do the same thing with Cheerio, but it fails.
Here is my code :
let popReportCookies;
router.addDefaultHandler(async ({ enqueueLinks, log, session, crawler, request }) => {
    log.info(request.loadedUrl)
    popReportCookies = session.getCookieString('https://www.example.com/grading/pop-report')
    for (const setId of setIds) {
      let setUrl = `https://www.example.com/grading/set_match/${setId}`
      const request = {
        url: setUrl,
        headers: {
          cookie: popReportCookies,
        },
    };
    await crawler.requestQueue.addRequest(request, {forefront: true});
  }
  await enqueueLinks({
    globs: ['https://www.example.com/grading/set_item_listing_grade?set_id=**'],
    label: 'setItemListing'
  });
});
Was this page helpful?