-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
community[patch]: feat: add headers param to cheerio loader #5806
community[patch]: feat: add headers param to cheerio loader #5806
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -92,11 +99,13 @@ export class CheerioWebBaseLoader | |||
caller: AsyncCaller, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there! I noticed that this code change introduces a new HTTP request using the fetch
function with the addition of the headers
parameter. I've flagged this for your review to ensure it aligns with the project's requirements. Let me know if you have any questions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall looks good, left a couple comments. Thanks for adding this!
this.textDecoder, | ||
this.headers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is passing headers via the options
field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad
options?: CheerioOptions, | ||
headers?: Headers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we combine these? Something like this:
static async _scrape(
...other args...
options?: CheerioOptions & { headers?: Headers },
) {
const { headers, ...cheerioOptions } = options ?? {};
...existing code
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Thank you! |
Feature request: Add a 'fetch headers' parameter to the Cheerio loader to accommodate different results based on the user-agent used.