BuilderIO / gpt-crawler

Crawl a site to generate knowledge files to create your own custom GPT from a URL
https://www.builder.io/blog/custom-gpt
ISC License
18.16k stars 1.88k forks source link

Use new `crawler.exportData` helper #64

Open B4nan opened 7 months ago

B4nan commented 7 months ago

Hello from the crawlee team!

Just a small suggestion, I was taking a peek at the code and saw you do this to create a data bundle at the end.

https://github.com/BuilderIO/gpt-crawler/blob/27b65d36d42660ad925ec36c399f717b8f359726/src/core.ts#L115-L129

We recently added a new helper that does exactly the same:

https://crawlee.dev/api/basic-crawler/class/BasicCrawler#exportData

So you could replace the whole function with a simple crawler.exportData(config.outputFileName) call, and it will support both JSON and CSV automatically (based on the file extension).