Skip to content
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

fix: use initial cookies hook #77

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/src/crawler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Dataset, NonRetryableError, PlaywrightCrawler, createRequestDebugInfo, log } from 'crawlee';

import { initialCookiesHook } from './hooks/initial-cookies.js';
import { crawlRoute } from './routes/crawl-route.js';
import { Config } from './types/config.js';
import { CrawlerState } from './types/crawler-state.js';
Expand All @@ -26,6 +27,7 @@ export const createCrawler = async (config: Config) => {
maxRequestsPerCrawl: maxPagesPerCrawl,
requestHandler: crawlRoute,
preNavigationHooks: [
initialCookiesHook,
async () => {
const state = await crawler.useState<CrawlerState>();
if (state.pagesOpened >= maxPagesPerCrawl) {
Expand Down
4 changes: 4 additions & 0 deletions shared/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
This changelog tracks updates to both GTP Scraper and Extended GPT Scraper actors.

# 2024-10-07
*Fixes*
- Fixed initial cookies not being set correctly from input.

# 2024-09-22
*Fixes*
- Fixed a bug where HTML minimization was failing on some specific websites.
Expand Down