A C# Web Crawler

本文介绍了一款使用C#编写的网络爬虫,能够下载网页及其附件,适用于在线商店等特定场景。爬虫遵循特定逻辑,从单一URL开始抓取页面并解析,递归寻找所有链接直至遍历整个网站。但遇到某些网站时,如Firefox可以正常访问,爬虫却无法获取内容,返回404错误。作者提出考虑使用外部工具如wget来替代C# Web API进行网页内容下载。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Here is a C# Web Crawler that could help you download web pages and attachments from one web-site. Such kind of crawler used vastly among some online stores during their beginning stage. They called them network spider, robot, crawler or radar.  They were trained well to retrieve only some kind of information that not like Google, Baidu does. They service their own small and special group of customizers.
crawler

The logic behind the web crawler is very easy: given by one url, the crawler will download this page, and parse and find all Urls. It repeat the whole process again for all those new found urls until all Urls were visited.  The full source code could be download from here.

 

Something need to fix
bugs 
This crawler could not work well when come across some web sites. I could access those web sites from the FireFox or other web browser. But it seems this crawler could not access those web server, error ‘<404> Not Found 'always report. If any one have some well work solutions, please let me know, thanks!  Maybe I could use external tools to download the web content instead of using native C# web API, may be I could use ‘wget’or something similar.


Reference
http://www.digitalcoding.com/Code-Snippets/C-Sharp/C-Code-Snippet-Download-HTML-Web-Page.html

转载于:https://www.cnblogs.com/open-coder/archive/2013/01/21/2870468.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值