GithubHelp home page GithubHelp logo

tempbottle / csharpcrawler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zhaotianff/csharpcrawler

0.0 1.0 0.0 50.39 MB

C#爬虫示例程序,想学习爬虫入门知识的可以看过来。后续会慢慢加入更多爬虫相关的知识。

License: MIT License

C# 98.90% HTML 1.10%

csharpcrawler's Introduction

C#爬虫项目

CSharpCrawler

GitHub stars All releases Github forks All issues

CSharpCrawler 🕷️

关于项目

C#开发爬虫的知识总结,目前还在更新中。这并不是一个完整的爬虫程序,只是一些示例。

为什么要拿C#开发爬虫项目,因为个人还是比较喜欢C#。C#虽然库少一点,但想要的功能基本还是能实现的。
总结的知识点如果什么错误之处,还恳请大家提个issue指正,一起学习进步( ̄▽ ̄)/

功能介绍

  • 基础知识

  • 网页抓取原理

    • 使用套接字来获取网页源码
  • 法律与道德约束

  • 抓取网页

    • HttpWebRequest类的使用
    • HttpClient类的使用
    • 获取指定url的IP地址
    • 获取指定url的网页头信息
    • 如何从网页源码中提取页面的编码
  • 抓取动态网页

    • 使用CEFSharp来抓取动态网页
    • 使用WebBrowser(IE)来抓取动态网页
    • 使用Puppeteer来抓取动态网页
    • 使用Selenium来抓取动态网页
  • WebAPI调用

    • 获取实时天气

      • 调用**天气网公开API接口来获取天气
    • 获取Bing每日图片

      • 调用cn bing API接口来获取Bing每日图片
  • 获取网页DOM

  • 使用CSS选择器和XPath选取元素

    • CSS选择器
    • XPath
  • 正则表达式的使用

    • 正则表达式的基础知识和基本使用;
    • 正则表达式中的分组构造;
    • 常用匹配模式;
  • Url抓取(当Url太多时,UI会卡)

    • 抓取指定网址的全部链接
    • 通过指定深度,抓取子网页的全部链接
    • 动态网页链接抓取
    • 限定抓取当前页面的子链接
  • 图片抓取

    • 抓取指定url页面中的图片,通过配置url的页码规则,来进行翻页。
    • 自动获取下一页
  • 文件下载

    • 使用WebClient类下载文件
    • 多线程下载文件
    • 从文件加载批量下载
  • 多线程抓取

  • 抓包工具使用

  • 模拟登录并获取登录后的内容

    • 使用Cookie(实现中)
    • 使用Selenium(实现中)
      • 说明:示例程序使用的是EdgeDriver,所以需要Windows10系统,如果需要其它浏览器Driver,可自行修改。
      • 测试系统:Windows 10 1703 Edge 15.15063.0,如果Edge驱动版本不一致,需要手动更新至对应的版本。
  • 必应图片搜索(仅供交流学习使用,请勿用作商业用途)

    • 实现必应图片搜索的功能
    • 翻页及优化(待更新)
  • 爬虫数据存储

    • Berkeley DB

      • 介绍BerkeleyDB以及使用方式
    • SQLite

      • 介绍SQLite以及使用方式
  • 小例子-全国家常菜价格统计(仅供交流学习使用,请勿用作商业用途)

    • 获取全国城市,以及城市代码
    • 抓取家常菜价格
    • 生成统计图表
  • 小例子-通用抓取

    • 电商类网站
    • 新闻类网站(待更新)
  • 将网页保存为图片/PDF

Roadmap

  • Url Encode/Decode 原理
  • 抓包工具Charles的使用
  • 使用抓包工具分析网站接口
  • 使用抓包工具分析APP接口
  • 验证码识别(字符验证码,滑块验证码)
  • BloomFilter算法
  • NLP基础
  • 中文分词
  • Lucene.net使用
  • 优先级队列实现
  • 基本爬虫架构
  • 分布式爬虫架构
  • 抓取豆瓣书评
  • 当抓取的数据到非常大的的数量级时该怎么处理
  • 使用代理

开发环境

Visual Studio 2013 + .Net 4.5
Visual Studio 2015 + .Net 4.5.2
Visual Studio 2017 + .Net 4.7.2

如果没有安装Blend SDK,GAC中没有System.Windows.Interactivity.dll,需要自己引用bin/x64/Debug目录下的System.Windows.Interactivity.dll

编译时可能会显示各种库找不到,Nuget还原下包就可以正常编译了

更新CEF至85.3.130版本后,会出现找不到ChromiumWebBrowser的问题。解决方法是:还原Nuget包后重新打开项目

Berkeley DB需要引用bin/x64/Debug目录下的libdb_dotnet181.dll,运行时还需要libdb_csharp181.dll和libdb181.dll,已置于bin/x64/Debug目录下

使用的三方组件

软件截图

start up

start up

start up

file download

file download

file download

爬虫项目

License

MIT License.

csharpcrawler's People

Contributors

dependabot[bot] avatar zhaotianff avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.