← 返回 anthropic 的题目列表Web Crawler with Asyncio
类型:online_judge
Write an asynchronous web crawler in Python to scrape content from a given website. The crawler should be capable of efficiently fetching and parsing pages, including downloading and parsing images.
Requirements:
Use asyncio to implement the asynchronous crawler.
Write a function to parse the page, extracting the title and all image links from the page.
Image links must be downloaded and saved locally.
Handle exceptions such as request timeout or page not found.
Test Cases:
Input a webpage URL and output the webpage title and the number of images downloaded.
Test Case Size:
Initial input is a list containing 5 different webpage URLs.
Note:
Maintain the code structure and readability.
Do not use third-party web scraping libraries.
Example
Input
["http://example.com/page1"]