Delphi uses Idhttp to do Web page data grabbing considerations

Source: Internet
Author: User

The Webbrowse way is not discussed here. Using Indy's idhttp get post directly makes it easy to get web data.

But it's not that easy to crawl a large number of data programs without crashing. These years have also done a lot of similar tools summed up a few good memory than bad writing.

  1. Memory leaks get page text with HTML parsing specific to the Delphi estimate using Mshtml Htmltotext method, this scheme again large data volume will be memory overflow caused the program crashes, and this is not known to every programmer. Solution: Use your own HTML parsing class here I would like to thank Wu Csdn (called) This class has been very perfect there is no memory leak and there is no parsing of the page.
  2. Out of memory. Get down the data we generally take tstrings to memory staging, but when the amount of data reached millions of programs will eat all the memory and reported out of a memory solution is simple timing to save as a file.
  3. The thread pool. Download we all want to be as fast as possible so it's easy to use multithreaded scenarios. Again, I recommend using a thread pool instead of creating a frequent destruction thread.
  4. Exception handling. Brush Web page data will be a variety of exotic strange data at this time we need to filter writing robust code has ensured that the program does not over.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.