开发者

C# WebClient() Downloading a specific part of a website

Ok I want to develop a scraping application to download specific text inside a div ta开发者_如何学编程g on a website. Lets take for example

<div class="main_content">WOTEVER GOES IN HERE, GOES IN HERE</div>

How would I go about downloading the text

WOTEVER GOES IN HERE, GOES IN HERE

I understand I would need to use WebClient() with

.DownloadFile(sourceFileAddress, destinationFilePath);

Thankyou


HTTP requests are done on the "resource" basis and this resource is a file -> you can't download some text from a page, you need to download the file and parse it.

If the file is eg. very big and you know the div is at the beginning you may consider using TCP/IP sockets and handling the request and response manually (parsing on the fly), but I don't really know if that would give you any benefit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜