Skip to content

Commit

Permalink
fix: scraping multiple URLs with disabled saveSnapshots (#91)
Browse files Browse the repository at this point in the history
* fix: scraping multiple URLs with disabled `saveSnapshots`

* docs: update changelog
  • Loading branch information
Patai5 authored Dec 30, 2024
1 parent 226a7e9 commit b304920
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions code/src/routes/crawl-route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,9 @@ export const crawlRoute = async (context: PlaywrightCrawlingContext<CrawlRouteUs
const contentMaxTokens = model.modelConfig.maxTokens * 0.9 - instructionTokenLength; // 10% buffer for answer
const pageContent = maybeShortsTextByTokenLength(originPageContent, contentMaxTokens);

let snapshotKey: string | undefined;
const snapshotKey = Date.now().toString();
let sentContentKey: string | undefined;
if (saveSnapshots) {
snapshotKey = Date.now().toString();
sentContentKey = `${snapshotKey}-sentContent.${pageFormat === PAGE_FORMAT.MARKDOWN ? 'md' : 'html'}`;
await utils.puppeteer.saveSnapshot(page, {
key: snapshotKey,
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-12-30
*Fixes*
- Fixed extraction of multiple URLs with disabled `saveSnapshots` option.

# 2024-11-17
*Features*
- Improved GPT call handling, which should parallelize the calls together with the crawling better.
Expand Down

0 comments on commit b304920

Please sign in to comment.