C++网络爬虫抓取图片

1、首先取一个初始网页,例如百度图片里面的网页(假设url为 http://image.baidu.com/channel/fashion );

2、向image.baidu.com发送一个请求(GET /channel/fashion HTTP/1.1 Host:image.baidu.com............);

3、保存image.baidu.com回应的内容response;

4、在response中查找<href>标签中的网址,并保存下来(假设保存到hrefs容器中);

5、在response中查找<img>标签中的图片地址,并保存下来(假设保存到imgs容器中);

6、下载imgs中所有的图片;

7、找到hrefs容器中的一条网址a;

8、重复2到6步骤;

9、删除网址a;

10、重复7到9步骤。

-----------------------------------------------------------------------------------------------

原文地址:https://www.cnblogs.com/howardhuo/p/4632755.html