@@ -132,7 +132,7 @@ def __init__(self, use_cached_html=False, js_code=None, **kwargs):
132
132
133
133
# chromedriver_autoinstaller.install()
134
134
# import chromedriver_autoinstaller
135
- # crawl4ai_folder = os.path.join(Path.home(), ".crawl4ai")
135
+ # crawl4ai_folder = os.path.join(os.getenv("CRAWL4_AI_BASE_DIRECTORY", Path.home() ), ".crawl4ai")
136
136
# driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=self.options)
137
137
# chromedriver_path = chromedriver_autoinstaller.install()
138
138
# chromedriver_path = chromedriver_autoinstaller.utils.download_chromedriver()
@@ -205,7 +205,7 @@ def crawl(self, url: str, **kwargs) -> str:
205
205
url_hash = hashlib .md5 (url .encode ()).hexdigest ()
206
206
207
207
if self .use_cached_html :
208
- cache_file_path = os .path .join (Path .home (), ".crawl4ai" , "cache" , url_hash )
208
+ cache_file_path = os .path .join (os . getenv ( "CRAWL4_AI_BASE_DIRECTORY" , Path .home () ), ".crawl4ai" , "cache" , url_hash )
209
209
if os .path .exists (cache_file_path ):
210
210
with open (cache_file_path , "r" ) as f :
211
211
return sanitize_input_encode (f .read ())
@@ -275,7 +275,7 @@ def crawl(self, url: str, **kwargs) -> str:
275
275
self .driver = self .execute_hook ('before_return_html' , self .driver , html )
276
276
277
277
# Store in cache
278
- cache_file_path = os .path .join (Path .home (), ".crawl4ai" , "cache" , url_hash )
278
+ cache_file_path = os .path .join (os . getenv ( "CRAWL4_AI_BASE_DIRECTORY" , Path .home () ), ".crawl4ai" , "cache" , url_hash )
279
279
with open (cache_file_path , "w" , encoding = "utf-8" ) as f :
280
280
f .write (html )
281
281
0 commit comments