Ask HN: How to create a Web crawler?
I am creating a website for price comparison. I want to fetch the price of a single product from multiple shopping carts.
I have some questions regarding this.
1) What is the best way to fetch price form different websites?
2) Sometime a single product have different name on different shopping carts. How to handle this problem?
3) When I will send multiple requests on a website (shopping cart) using my created web crawler (or web spider) will they block me or can they take a legal action against me?
4) How can I make the process automated to omit manual error.
I will start with 3 shopping carts initially. Most of the shopping carts are not providing any type of API or other type of access to their products. Currently my approach is to tear down the HTML and find required information from HTML.
I want to go with C# & .Net technology because I am good in it (this is what I thought).
Please suggest what is the best way of doing this.
9 comments
[ 4.6 ms ] story [ 27.2 ms ] threadAs for question number 4: Impossible unless you have strong AI (see also: How Apple automatically collated their map data from three different sources and what they got as a result). You see, fully automated data collection from multiple source will introduce more errors than manual methods (which are slow, OTOH); automated collection and manual verification is necessary.
Its worked for me up to some extent.
[0] http://scrapy.org/
I would definitely recommend python for web scraping. There are a ton of tutorials out there. I believe there are even a few from Google which are pretty good.
http://www.udacity.com/view#Course/cs101/CourseRev/apr2012
A single product might have a different name, but you might try to scrape the product ID's if they exist. Product IDs should be unique. If both websites provide those ID's you could compare those in your database. If that's not possible: as a small hack you could also use Amazon Mechanical Turk to issue manual tasks to compare product names. This way, real people will check if two products are the same in case there is doubt. This will cost you a little, but you could give those people 5 cents per product comparison or something like that.
For question 3, some websites don't allow you to crawl their content. Read their ToS :-)
For the rest I agree with Piskvorrr, you could do some trial and error and learn on the fly or read some books (and still do trial and error and learn on the fly ;-)). Good luck!