From 1b30651d438279437da1ca5d0a84ca16957f2c3d Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Fri, 3 Jan 2025 02:49:34 +0100 Subject: [PATCH] Fix: [Errno 36] File name too long --- g4f/tools/web_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/g4f/tools/web_search.py b/g4f/tools/web_search.py index 26c28201163..667d9ab6775 100644 --- a/g4f/tools/web_search.py +++ b/g4f/tools/web_search.py @@ -112,7 +112,7 @@ async def fetch_and_scrape(session: ClientSession, url: str, max_words: int = No bucket_dir: Path = Path(get_cookies_dir()) / ".scrape_cache" / "fetch_and_scrape" bucket_dir.mkdir(parents=True, exist_ok=True) md5_hash = hashlib.md5(url.encode()).hexdigest() - cache_file = bucket_dir / f"{url.split('?')[0].split('//')[1].replace('/', '+')}.{datetime.date.today()}.{md5_hash}.txt" + cache_file = bucket_dir / f"{url.split('?')[0].split('//')[1].replace('/', '+')[:16]}.{datetime.date.today()}.{md5_hash}.txt" if cache_file.exists(): return cache_file.read_text() async with session.get(url) as response: