Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I download only part of a page?

Tags:

c#

I have 100 pages on my site, but I want download only part a page instead of all page content.

I want just one box of each page to download, the file size is 10 KB. For this I Use WebClient and htmlagilitypack .

 WebClient Client = new WebClient();
 var result = Encoding.GetEncoding("UTF-8").GetString(Client.DownloadData(URL));

enter image description here

like image 398
osman Rahimi Avatar asked Jan 03 '15 09:01

osman Rahimi


People also ask

How do I download part of a Web page?

You can also right-click anywhere on the page and select Save as or use the keyboard shortcut Ctrl + S in Windows or Command + S in macOS. Chrome can save the complete web page, including text and media assets, or just the HTML text.

How do I download text from a website?

Click and drag to select the text on the Web page you want to extract and press “Ctrl-C” to copy the text. Open a text editor or document program and press “Ctrl-V” to paste the text from the Web page into the text file or document window. Save the text file or document to your computer.

Is it possible to download a website?

Download an Entire Website With an Offline Browser. When you want an offline copy of an entire website, you can use a website copying program. These apps download all website files to a computer and arrange the files according to the site structure.


1 Answers

Unfortunately, that's not possible, because HTTP is not designed to deliver a specific part of a web page. It does support range requests, but for that you would need to know where exactly (in terms of bytes) the desired content is located.

You can

  • download the whole page and then
  • use a HTML parsing library to extract the part you need.
like image 158
Heinzi Avatar answered Sep 22 '22 14:09

Heinzi