crawl4ai icon indicating copy to clipboard operation
crawl4ai copied to clipboard

Failed to crawl due to charmap error

Open ghost opened this issue 2 years ago • 9 comments

"[LOG] 🌤️ Warming up the WebCrawler Error retrieving cached URL: no such column: links [LOG] 🌞 WebCrawler is ready to crawl Error retrieving cached URL: no such column: links [ERROR] 🚫 Failed to crawl https://www.nbcnews.com/business, error: Failed to crawl https://www.nbcnews.com/business: 'charmap' codec can't encode character '\x80' in position 511317: character maps to None"

I get this error while i have my encoding set to utf-8 on vs code. I'm new and it's probably stupid error but hopefully somebody can help me.

ghost avatar Jul 04 '24 17:07 ghost

I'm facing the same issue

Rishinc2000 avatar Jul 05 '24 01:07 Rishinc2000

@pixelr-d Never say that my friend, every great discovery started from a "stupid" moment :) Btw I checked, there is no such error.

image

Please help me to replicate the error. You can share with me your system/os details, also your code please. Let me have fun with your stupid error ;) Same to you @Rishinc2000 , please share your case.

unclecode avatar Jul 05 '24 05:07 unclecode

Sure @unclecode, I am running on Windows 11 using VS Code. I created a Python 3.11 conda environment and only installed this repo. Then I ran the first example code given in the repo. I am getting a charmap error. I am attaching an image of the code and the output here, I hope you can help me get it running.

Screenshot 2024-07-08 071117

Rishinc2000 avatar Jul 08 '24 01:07 Rishinc2000

@Rishinc2000 I am checking it, will update you soon

unclecode avatar Jul 08 '24 07:07 unclecode

Using the newest python on windows 10 on vs code, downloaded the basic version of library. The demo code gives error as in @Rishinc2000 image

ghost avatar Jul 08 '24 12:07 ghost

@pixelr-d @Rishinc2000 This has been resolved in the new version v0.2.74. Please kindly clean up everything, then proceed with these steps and test your code again. The code below shows how I tested it on my Windows machine. It is now functioning after resolving the problem. Better also to remove ".crawl4ai" from your home directory.

git clone https://github.com/unclecode/crawl4ai
cd crawl4ai
py -3.11 -m venv myenv
myenv\Scripts\activate
pip install -e .

This should work, please let me know if you still have the issue.

unclecode avatar Jul 08 '24 14:07 unclecode

@unclecode Works great and no further issues

ghost avatar Jul 09 '24 15:07 ghost

Now it's working for almost all the websites thank you for all the support. I want to know how to use local LLMs?

jason-jos avatar Jul 09 '24 18:07 jason-jos

@xarchangel12 Simply pass ollama model like this:

result = crawler.run(
        url=url,
        word_count_threshold=1,
        extraction_strategy= LLMExtractionStrategy(
            provider= "ollama/phi3", api_token = "no-token", 
            ... Rest of your Parameters ...
        ),            
        bypass_cache=True,
)

unclecode avatar Jul 10 '24 07:07 unclecode