10 Replies
@NeoNomade just advanced to level 5! Thanks for your contributions! 🎉
@Pepa J regarding cookies.
@NeoNomade Are you using pupeteer? https://pptr.dev/api/puppeteer.page.setcookie
then each of the cookies has to be provided as separate paramter. Try:
Page.setCookie() method | Puppeteer
Signature:
Ok, then it also need to be changed in Crawlee docs, will try and come back with an answer
may you provide the link for crawlee docs?
Session | API | Crawlee
Sessions are used to store information such as cookies and can be used for generating fingerprints and proxy sessions.
You can imagine each session as a specific user, with its own cookies, IP (via proxy) and potentially a unique browser fingerprint.
Session internal state can be enriched with custom user data for example some authorization toke...
same error.
What I'm trying to achieve : do one request, get cookies from there, and use them in all the future requests.
I am not sure do you mean by
need to be changed in Crawlee docs
. The getCookies
is working fine, I was mentioning your usage of setCookies
that it require to provide each cookie as separate parameter, which is same approach as in Puppeteer.
I just did PoC:
And it seems to be working fine. Once the cookies are stored, they are used in all upcoming requests.The PoC looks nice, but how do I filter the cookies in the preNavigationHooks, just for one URL ?
I have :
url1 , url2 ... url 50.
I want to take cookies from url1 and use them in url2...url50
still not working, I've pasted the entire cookies and error in paste bin
https://pastebin.com/98kunwBf @Pepa J
Sadly the link doesn't work for me 😦
how do I filter the cookies in the preNavigationHooks, just for one URLYou can set specific
label
for the request and then handle it this way in RouteHandler
, you may also not use label and make this happen inside the defaultRouteHandler
and then handle other requests in with routeHandler
related to another label
.
I am not really sure about your use-case but I think that from this example you may get the idea.
I want to take cookies from url1 and use them in url2...url50That is standard browser behavior if the urls share domain and there are no further restrictions on the cookies. In my propose when you do the first run the value
storedCookies
is not set. For the other requests 2-infinity
the cookies were already stored in KV store, so they will be loaded and used from it.