本文实例为大家分享了c#简单爬虫案例,供大家参考,具体内容如下
using system; using system.collections.generic; using system.linq; using system.net; using system.text; using system.text.regularexpressions; using system.threading.tasks; namespace consoleapplication1 { class program { static void main(string[] args) { webclient wc = new webclient(); wc.encoding = encoding.utf8; string html = wc.downloadstring("http://www.lagou.com/"); matchcollection matches = regex.matches(html, "<a.*jobs.*>(.*)</a>"); foreach (match item in matches) { console.writeline(item.groups[1].value); } console.writeline(matches.count); console.readkey(); } } }
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。
如对本文有疑问, 点击进行留言回复!!
使用Visual Studio2019创建C#项目(窗体应用程序、控制台应用程序、Web应用程序)
C#实现获取本地内网(局域网)和外网(公网)IP地址的方法分析
网友评论