C#简单爬虫案例分享
时间:2022-12-09 09:56:28|栏目:.NET代码|点击: 次
本文实例为大家分享了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();
}
}
}
上一篇:asp.net core实体类生产CRUD后台管理界面
栏 目:.NET代码
下一篇:c#中Empty()和DefalutIfEmpty()用法分析
本文标题:C#简单爬虫案例分享
本文地址:http://www.codeinn.net/misctech/220939.html






