基本信息
源码名称:百度网盘爬虫源码下载 采集百度网盘资源
源码大小:11.78M
文件格式:.rar
开发语言:C#
更新时间:2015-12-21
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍



using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Web.Mvc;
using Resources.Crawl.Common;
using Resources.Crawl.Services;

namespace Resources.Crawl.Web.Controllers
{
    /// <summary>
    /// 网盘资源搜索 控制器
    /// </summary>
    public class ResourceCrawlController : Controller
    {
        public ActionResult Index()
        {
            IResourcesCrawl crawl = ResourcesCrawlFactory.GetInstance().GetResourcesCrawler(SearchEngineEnum.Bing);
            string searchWord = Request.QueryString["searchWord"],
                pageNow = Request.QueryString["pageNow"];
            if (string.IsNullOrEmpty(searchWord))
            {
                searchWord = string.Empty;
            }
            if (string.IsNullOrEmpty(pageNow) || !Regex.IsMatch(pageNow, @"^\d $"))
            {
                pageNow = "1";
            }

            ResponseBase responseBase = crawl.Excute(new RequestBase
            {
                SearchWord = searchWord,
                PageNow = Convert.ToInt32(pageNow)
            });

            ResourceInfoDto model = responseBase.SerializeObject().DeserializeObject<ResourceInfoDto>();

            ViewBag.SearchWord = searchWord;
            return View(model);
        }
    }

    public class ResourceInfoDto
    {
        public int StatusCode { get; set; }
        public string Message { get; set; }
        public int PageNow { get; set; }
        public int PageSize { get; set; }
        public int TotalPage { get; set; }
        public int TotalRecords { get; set; }
        public List<ResourceBodyEntity> Body { get; set; }
    }

    public class ResourceBodyEntity
    {
        public string Title { get; set; }
        public string Href { get; set; }
        public string Description { get; set; }
        public string Cite { get; set; }
        public string Date { get; set; }
        public string ContentHtml { get; set; }
    }
}