-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot import name 'WebCrawler' from 'crawl4ai' #122
Comments
Thanks for using our library. I do have a question. When you say running our library with Microsoft Edge and Windows, could you please clarify what you mean by that? Crawl4AI does not have any integration with Microsoft Edge or any other browser on your computer. So, I'm guessing you might be experiencing an error related to a Windows OS. If that's the case, I manage some additional tests on Windows to determine the root cause of the issue. I will also review the code you shared to see if I can identify the problem. Meanwhile, We are working on adding a scraping engine to the library, so please stay tuned for that update. |
Hi @unclecode, thanks for your interest about our problem (we work together with @gulnihalk). |
@asumansaree Sorry for my late response, I've been on a short trip. I figured why it behaves this way. You are still using it in previous version which was synchronous by default, now it's asynchronous. To use it in sync mode, you have to import the web crawler directly from the crawler module from crawl4ai import AsyncWebCrawler
async def simple_crawl():
async with AsyncWebCrawler(verbose=True) as crawler:
result = await crawler.arun(url="https://www.nbcnews.com/business")
print(result.markdown[:500])
async def main():
await simple_crawl()
if __name__ == "__main__":
asyncio.run(main()) |
Hi, @unclecode, I have the same problem when running your test code: from crawl4ai.web_crawler import WebCrawler seems that the package does not work for my IDE, and cannot find the solution |
@Themisstone Would you please try the recent version 0.4.2? If it still doesn't work, can you share with me your Python version and the operating system specs? I may have some IDs for you. |
Hi, when I try to run crawl4ai with microsoft edge on windows, I have this error below, ( same code works for ubuntu on chrome)
Traceback (most recent call last):
File "d:\work\indexing\scrapper.py", line 1, in
from crawl4ai import WebCrawler
ImportError: cannot import name 'WebCrawler' from 'crawl4ai' (C:\Users\abc..\Local\Programs\Python\Python310\lib\site-packages\crawl4ai_init_.py)
and here is my code below:
Do you have any idea?
The text was updated successfully, but these errors were encountered: