static void Main(string[] args)
{
WebClientDemo(); Console.ReadLine();
} static void WebClientDemo()
{
webContent = File.ReadAllText("img2.txt");
var urlsList = webContent.Split(new string[] { "\"", "" }, StringSplitOptions.None).ToList().Where(x => x.StartsWith("http")).Where(x => x.EndsWith("jpg") || x.EndsWith(".png") || x.EndsWith(".jpeg")); foreach (var ul in urlsList)
{
WebClientDownload(ul);
}
} static void WebClientDownload(string url)
{
try
{
using (WebClient wc = new WebClient())
{ string[] urls = url.Split(new string[] { "/" }, StringSplitOptions.None);
string fileName = "Imgs2\\"+ urls[urls.Length - ];
wc.DownloadFile(url, fileName);
++num;
Console.WriteLine(url);
}
}
catch
{ }
}

C# extract img url from web content then download the img的更多相关文章

  1. springboot Serving Web Content with Spring MVC

    Serving Web Content with Spring MVC This guide walks you through the process of creating a "hel ...

  2. URL相关Web APIs

    参考文档:MDN> Web API接口 > URLUtils MDN > Web API接口 > URL MDN > Web API接口 > Location MD ...

  3. java.lang.ClassNotFoundException: org.springframework.web.content.ContextLoaderListener

    1.错误描写叙述 严重: Error configuring application listener of class org.springframework.web.content.Context ...

  4. HttpApplication IHttpAsyncHandler, IHttpHandler, IComponent, IDisposable ps url System.Web.dll

    // 摘要:     //     定义 ASP.NET 应用程序中的所有应用程序对象共有的方法.属性和事件.此类是用户在 Global.asax 文件中所定义的应用程序的基类.     [Toolb ...

  5. 关于URL、Web的一些概念

    关于URL ★ 书写路径时,网络文件用斜杠“/”划分不同层级,本地文件管理系统用反斜杠“\”,分隔不同层级:                               如下图示   ★  绝对/相对 ...

  6. Java通过URL 从web服务端获取数据

    1.Java 通过HttpURLConnection Post方式提交json,并从服务端返回json数据 package Demo.Test; import java.io.ByteArrayOut ...

  7. python网络爬虫(14)使用Scrapy搭建爬虫框架

    目的意义 爬虫框架也许能简化工作量,提高效率等.scrapy是一款方便好用,拓展方便的框架. 本文将使用scrapy框架,示例爬取自己博客中的文章内容. 说明 学习和模仿来源:https://book ...

  8. odoo开发笔记 -- 还原数据库后,异常:ir_attachment: IOError: [Errno 2] No such file or directory: u'/var/...'

    场景描述: 恢复Odoo数据后,抛出错误导致无法进入页面 -- ::, INFO aeo odoo.addons.base.ir.ir_attachment: _read_file reading / ...

  9. odoo13之文件预览widget/模块

    本文示例代码可查看github仓库:odoo13_file_preview 文件预览效果图展示 效果描述: 1.当点击图片或者文件时展开图片. 2.当点击关闭按钮时关闭图片预览. 3.当点击下载按钮时 ...

随机推荐

  1. 查看php相关信息

    1.最常见的就是 创建一个  php页面  ,例如 test.php,  内容如下 <?php phpinfo();?> 直接访问 这个页面,就可以看到php的 信息了 2.其它方法  直 ...

  2. iptables 实例

    开启ip段192.168.1.0/24端的80口 开启ip段211.123.16.123/24端ip段的80口 # iptables -I INPUT -p tcp --dport 80 -j DRO ...

  3. Mysql 升级重装后连接出错 Table \'performance_schema.session_variables\' doesn\'t exist

    升级重装后  连接出错 报这个错误 Table 'performance_schema.session_variables' doesn't exist   使用这个命令即可 [root@localh ...

  4. 1215 - Finding LCM

    1215 - Finding LCM   LCM is an abbreviation used for Least Common Multiple in Mathematics. We say LC ...

  5. Mac解决:xcode-select: error: command line tools are already installed, use "Software Update" to install updates

    1.因为node项目终端报错: No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'. No receipt for 'com ...

  6. EF CORE中复杂类型的映射

    实体映射时,遇到复杂类型,可选择下述方法处理: NotMapped,跳过映射 在复杂类型上声明 [Owned],但仅限该复杂类型是全部由简单值类型组成的 自定义序列化方法   示例: IPInfo使用 ...

  7. NServiceBus 入门到精通(一)

    什么是NServiceBus?NServiceBus 是一个用于构建企业级 .NET系统的开源通讯框架.它在消息发布/订阅支持.工作流集成和高度可扩展性等方面表现优异,因此是很多分布式系统基础平台的理 ...

  8. 基于SSM开发学生信息管理系统源码

    开发环境:    Windows操作系统开发工具: Eclipse+Jdk+Tomcat+MySql数据库 运行效果图 源码及原文链接:https://javadao.xyz/forum.php?mo ...

  9. POSIX简介

    POSIX:Potable Operating System Interface of UNIX (可移植操作系统接口),是IEEE为要在各种UNIX操作系统上运行软件,而定义API的一系列互相关联的 ...

  10. idea svn提交时,performing vcs refresh时间很长的解决办法

    解决方法:version control -> local changes -> local changelist 列表中无用的文件或文件夹右键选择svn忽略 ps:原因是文件太多,导致对 ...