unclecode / crawl4ai

πŸ”₯πŸ•·οΈ Crawl4AI: Open-source LLM Friendly Web Crawler & Scrapper
Apache License 2.0
16.63k stars 1.23k forks source link

Screenshot issue #162

Closed hishambutt closed 1 month ago

hishambutt commented 1 month ago

Hi I was going through crawl4ai quick guide and I get None when I print result.screenshot.

code

from crawl4ai import AsyncWebCrawler
import base64

import base64

async def main():
    async with AsyncWebCrawler(verbose=True) as crawler:
        result = await crawler.arun(url="https://www.nbcnews.com/business", screenshot=True)
        print(result.screenshot)
        # with open("screenshot.png", "wb") as f:
        #     f.write(base64.b64decode(result.screenshot))
        # print("Screenshot saved to 'screenshot.png'!")

if __name__ == "__main__":
    asyncio.run(main())

Output

[LOG] 🌀️  Warming up the AsyncWebCrawler
[LOG] 🌞 AsyncWebCrawler is ready to crawl
[LOG] πŸ•ΈοΈ Crawling https://www.nbcnews.com/business using AsyncPlaywrightCrawlerStrategy...
[LOG] βœ… Crawled https://www.nbcnews.com/business successfully!
[LOG] πŸš€ Crawling done for https://www.nbcnews.com/business, success: True, time taken: 3.21 seconds
[LOG] πŸš€ Content extracted for https://www.nbcnews.com/business, success: True, time taken: 0.03 seconds
[LOG] πŸš€ Extraction done for https://www.nbcnews.com/business, time taken: 0.03 seconds.
None
unclecode commented 1 month ago

Hi, thank you so much for using our library. Actually, your issue already reported. Could you please check this out https://github.com/unclecode/crawl4ai/issues/159? In our upcoming new version, which we're going to release by tomorrow, this issue has already been fixed.