Skip to content

Commit

Permalink
Merge pull request #194 from IdrisHanafi/feat/customize-crawl-base-di…
Browse files Browse the repository at this point in the history
…rectory

Support for custom crawl base directory
  • Loading branch information
unclecode authored Oct 24, 2024
2 parents 9ffa34b + a5f627b commit 32f57c4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crawl4ai/async_webcrawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ def __init__(
self,
crawler_strategy: Optional[AsyncCrawlerStrategy] = None,
always_by_pass_cache: bool = False,
base_directory: str = str(Path.home()),
**kwargs,
):
self.crawler_strategy = crawler_strategy or AsyncPlaywrightCrawlerStrategy(
**kwargs
)
self.always_by_pass_cache = always_by_pass_cache
self.crawl4ai_folder = os.path.join(Path.home(), ".crawl4ai")
self.crawl4ai_folder = os.path.join(base_directory, ".crawl4ai")
os.makedirs(self.crawl4ai_folder, exist_ok=True)
os.makedirs(f"{self.crawl4ai_folder}/cache", exist_ok=True)
self.ready = False
Expand Down

1 comment on commit 32f57c4

@phanitallapudi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait, why does it matter if we were to create a variable and use it, instead of directly using Path.home() like you were doing earlier?

Please sign in to comment.