• 大小: 0.78M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-14
  • 语言: C#
  • 标签: 爬虫  

资源简介


资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Text.Regularexpressions;
using System.Threading;
using System.Threading.Tasks;
using Wesley.Crawler.SimpleCrawler.Models;

namespace Wesley.Crawler.SimpleCrawler
{
    internal class Ctrip
    {
        private static void Main(string[] args)
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();

            var cityUrl = “http://hotels.ctrip.com/citylist“; //定义爬虫入口URL
            string cityHtml = HtmlTag.GetHtml(cityUrl Encoding.UTF8);
            var cityList = new List(); //定义泛型列表存放城市名称及对应的酒店URL
            //使用正则表达式清洗网页源代码中的数据
            var links = Regex.Matches(cityHtml
                @“]+href=““*(

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-05-22 14:48  Simple-Web-Crawler-master\
     文件        2518  2016-07-08 13:12  Simple-Web-Crawler-master\.gitattributes
     文件        3833  2016-07-08 13:12  Simple-Web-Crawler-master\.gitignore
     目录           0  2017-05-22 14:48  Simple-Web-Crawler-master\.vs\
     目录           0  2017-05-22 14:48  Simple-Web-Crawler-master\.vs\SimpleCrawler\
     目录           0  2017-05-22 14:48  Simple-Web-Crawler-master\.vs\SimpleCrawler\v14\
     文件       70656  2017-05-24 10:08  Simple-Web-Crawler-master\.vs\SimpleCrawler\v14\.suo
     文件        3256  2016-07-08 13:12  Simple-Web-Crawler-master\README.md
     文件        1029  2016-07-08 13:12  Simple-Web-Crawler-master\SimpleCrawler.sln
     目录           0  2017-05-24 10:08  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\
     文件        1612  2017-05-23 15:24  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\App.config
     文件        2223  2017-05-24 10:08  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Ctrip.cs
     文件       18375  2017-05-23 15:22  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\DbHelperOra.cs
     目录           0  2017-05-22 14:47  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Events\
     文件         840  2016-07-08 13:12  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Events\OnCompletedEventArgs.cs
     文件         445  2016-07-08 13:12  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Events\onerrorEventArgs.cs
     文件         425  2016-07-08 13:12  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Events\onstartEventArgs.cs
     文件       16209  2017-05-23 10:05  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\HtmlTag.cs
     文件       23796  2017-05-23 10:00  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\HttpRequestUtility.cs
     文件         547  2016-07-08 13:12  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\ICrawler.cs
     目录           0  2017-05-22 14:47  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Images\
     文件      466822  2016-07-08 13:12  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Images\1.携程网城市列表.png
     文件       59213  2016-07-08 13:12  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Images\2.抓取网页源代码.png
     文件       58956  2016-07-08 13:12  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Images\3.使用正则清洗数据.png
     文件       70128  2016-07-08 13:12  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Images\4.抓取城市下的酒店列表.png
     文件       37250  2016-07-08 13:12  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Images\5.并发抓取示例.png
     目录           0  2017-05-22 14:47  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Models\
     文件         287  2016-07-08 13:12  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Models\City.cs
     文件         335  2016-07-08 13:12  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Models\Hotel.cs
     文件       10361  2017-05-23 17:26  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Program.cs
     目录           0  2017-05-22 14:47  Simple-Web-Crawler-master\Wesley.Crawler.SimpleCrawler\Properties\
............此处省略24个文件信息

评论

共有 条评论