图片采集,你懂的~

tecnology tecnology 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
string ListUrl = "http://XXXX.cc/html/yazhou/index{0}.html";
System.Net.WebClient wc = new System.Net.WebClient();
HtmlAgilityPack.HtmlDocument listdoc = new HtmlAgilityPack.HtmlDocument();
HtmlAgilityPack.HtmlNode listbody=null;

HtmlAgilityPack.HtmlDocument cotentdoc = new HtmlAgilityPack.HtmlDocument();
HtmlAgilityPack.HtmlNode cotentbody = null;
for (int i = 1; i <= 33; i++)
{
string tempList = string.Format(ListUrl, i == 1 ? "" : i.ToString());
string htmlStr = wc.DownloadString(tempList);
if (htmlStr == null) continue;
listdoc.LoadHtml(htmlStr);
listbody = listdoc.DocumentNode;
HtmlAgilityPack.HtmlNodeCollection lists = listbody.SelectNodes("//div/ul/li");
foreach (HtmlNode list in lists)
{
var listname = list.SelectSingleNode("./a").Attributes["title"].Value;
var contenturl = "http://XXXX.cc/" + list.SelectSingleNode("./a").Attributes["href"].Value;

try
{
int end = 1;
int tonum=1;
for (int m = 1; m <= end; m++)
{

string willdir = @"D:\temp\1\" + listname;
string contentHtml = null;

if (m == 2)
{
contenturl = contenturl.Substring(0, contenturl.LastIndexOf(".htm")) + "_{0}.htm";
}
if (m >= 2)
{
contentHtml = wc.DownloadString(string.Format(contenturl, m.ToString()));
}
else
{
contentHtml = wc.DownloadString(contenturl);
}
cotentdoc.LoadHtml(contentHtml);
if (cotentdoc == null) continue;
cotentbody = cotentdoc.DocumentNode;
if (m == 1)
{
end = int.Parse(cotentbody.SelectSingleNode("//div[@class='pp']/font[@color='red']").InnerHtml.Trim());
System.IO.Directory.CreateDirectory(willdir);
}
var contentlists = cotentbody.SelectNodes("//div[@class='pp']//img");
foreach( var n in contentlists)
{
var picname = n.Attributes["src"].Value;
wc.DownloadFile(picname, willdir + "\\" + tonum.ToString() + ".jpg");
tonum++;
}
}
}
catch
{
continue;
}
}
}
...全文

相关推荐

阿里巴巴/天猫/淘宝商品图片批量采集工具商品采集软件

支持多线程,支持3个商店采集,分别是阿里巴巴批发网和tao宝网和天猫网的,可以采集主图以及详情图和商品标题等。做了差不多1年了,没想到还能用。嘿嘿

ghostcsa

python采集百度图片数据呐~没有你采集不了得图,只有你不想要

嗨喽~大家好呀,这里是魔王呐百度搜图是大家常用得一个找图小窝点,里面包含了各种地方得各种图片,如果你不会找图,去百度搜图准没错~今天我们就来采集一下百度图片叭~本篇代码提供者: 青灯教育-巳月老师python 3.8 运行代码pycharm 2021.2 辅助敲代码requestswin + R 输入 cmd 点击确定, 输入安装命令 pip install 模块名 (pip install requests) 回车在pycharm中点击Terminal(终端) 输入安装命令 对啦~要记得在代码文件相同

魔王不会哭

双目相机标定图片拍摄规范

双目相机标定图片拍摄规范 文章目录双目相机标定图片拍摄规范前言一、双目相机的布置二、标定板的选用三、图片采集的规范四、进行标定的软件(选看)五、靶标布置(选看)总结 前言 相机标定是进行视觉测量和定位的基础工作之一,标定参数准确与否直接关系到整个系统的精度,标定结果将影响后续进行其他解算。笔者根据自己在双目相机项目中的标定经验,和网络上查询到的大家对标定图片采集的意见进行了总结,现分享如下: 一、双目相机的布置 (1)要保证两个相机都是水平放置的,要固定在同一基准平面上,不能让相机有翻滚角,必须保证相机

Procrastinator^_^

懂车帝全系车型数据包含车型图片地址

懂车帝全系车型数据包含车型图片地址

拉灯的小手

电商淘宝、天猫、拼多多商品图片视频批量采集工具

无货源电商需要批量铺货采集商品图片和视频,该工具可以帮你快速一键批量下载导出商品主图、细节图、属性图、评论图和视频

tiantu22
评论 9
收藏 已收藏
分享
返回顶部
tecnology
C# 111,129 成员 642,538 内容