-
-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cookies are not working #446
Comments
Hi @abd-falyoun From your options it's hard to understand what went wrong without steps to reproduce. Maybe your website requires some additional headers or does another checks to reject access for automated tools. To verify it works you can try to call request directly with your headers and check the response. Also, I'm not sure what is the type of variable |
This issue has been automatically closed because there has been no response from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. |
How can I convert json cookie to format needed for Set-Cookie?
How can I convert json cookie to format needed for Set-Cookie? |
If I have 6 cookies like this: |
Hi @Christian-Martinez1 The Set-Cookie header is sent by the server in response to an HTTP request, which is used to create a cookie on the user's system. The Cookie header is included by the client application with an HTTP request sent to a server, if there is a cookie that has a matching domain and path. You may need to include |
In case someone is still looking for the answer, you can use
Example: import {CookieJar} from "tough-cookie";
import scrape from "website-scraper";
const cookieJar = new CookieJar();
await cookieJar.setCookie("foo=bar", "https://example.com");
const result = await scrape({
urls: ["https://example.com"],
directory: "/path/to/save/",
request: {
cookieJar
}
}); |
I've logged in into a webiste using
puppteer
then I saved cookies to a file, after that I provided these cookies towebsite-scraper
When I run the above code it redirects me to login page.
The text was updated successfully, but these errors were encountered: