Skip to content

Commit

Permalink
fix: use initial cookies hook (#77)
Browse files Browse the repository at this point in the history
* fix: use initial cookies hook

* docs: update changelog
  • Loading branch information
Patai5 authored Oct 7, 2024
1 parent dee78cb commit 51f2432
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
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

0 comments on commit 51f2432

Please sign in to comment.