Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dardanbujupaj committed Mar 18, 2024
1 parent 4400157 commit de3a868
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export class Crawler {
this.config.strategy == 'docssearch'
? new DocsearchScraper(this.sender, this.config)
: this.config.strategy == 'schema'
? new SchemaScraper(this.sender, this.config)
: new DefaultScraper(this.sender, this.config)
? new SchemaScraper(this.sender, this.config)
: new DefaultScraper(this.sender, this.config)
}

async run() {
Expand All @@ -63,22 +63,26 @@ export class Crawler {
//Create the router
const router = createPuppeteerRouter()


// type DefaultHandler = Parameters<typeof router.addDefaultHandler>[0];
router.addDefaultHandler(this.defaultHandler.bind(this))

const preNavigationHooks: PuppeteerHook[] = this.config.additional_request_headers ? [
async (crawlingContext) => {
crawlingContext.addInterceptRequestHandler(async (request) => {
request.continue({
headers: {
...request.headers(),
...this.config.additional_request_headers,
}
});
})
},
] : []
const preNavigationHooks: PuppeteerHook[] = this.config
.additional_request_headers
? [
async (crawlingContext) => {
await crawlingContext.addInterceptRequestHandler(
async (request) => {
return await request.continue({
headers: {
...request.headers(),
...this.config.additional_request_headers,
},
})
}
)
},
]
: []

const puppeteerCrawlerOptions: PuppeteerCrawlerOptions = {
requestQueue,
Expand Down

0 comments on commit de3a868

Please sign in to comment.