当前位置: 移动技术网 > IT编程>开发语言>c# > C#简单爬虫案例分享

C#简单爬虫案例分享

2019年07月18日  | 移动技术网IT编程  | 我要评论

本文实例为大家分享了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();  
    }
  }
}

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网