F # Tour 5-little Practice download Web page (crawler base Library)

Source: Internet
Author: User

Reference Article: https://swlaschin.gitbooks.io/fsharpforfunandprofit/content/posts/fvsc-download.html

The reference article teaches us if we use it in F #. NET Library to download a Web page, here, let me scatter it and make it into a base library that can be used to help write Crawlers.

first, I've made several changes to the downloaded code:

1, removed the callback, directly changed to save the text to the file, note that if the download picture can not be written like This.

2, use the flow to step-by-step Call. net, and Adds exception handling.

3. Add an async async method, which is the same as C # async, Await.

next, with async, It's natural for this download to be able to be concurrent, and the underlying function for auxiliary concurrency is this:

1, found on the StackOverflow a throttle auxiliary function, can be used to control the number of concurrent, Great.

2, with the flow and async.parallel implementation of Concurrency.

F # Tour 5-little Practice download Web page (crawler base Library)

Related Article

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.