Live data from Hacker News

How to crawl a quarter billion webpages in 40 hours (2012)

michaelnielsen.org

21–25 of 25 posts

Re: How to crawl a quarter billion webpages in 40 hours (2012)

#21
post #3

This was written in 2012, Its even easier these days by using SQS and Cloud Formation. 250 Million is a small number you are better of first going through Common Crawl and then use data from crawls to build a better seed list. Common Crawl now contains repeated crawls conducted every few months and also urls donated by blekko. https://groups.google.com/forum/m/#!msg/common-crawl/zexccXg...

Do you have any recommendations on crawling / detecting changes on a large set of data? For example, the RSS feeds for every podcast on the planet?

This has been my personal project for the past few months. There are around 240k podcasts in the iTunes index and it is fairly trivial to scrape their feed urls.

Most of the podcast apps that have feed crawler backends (Pocket Casts, Overcast, etc) poll all 240k podcast feeds fairly frequently. More popular podcasts are polled on the order of every 2-3 minutes while less popular podcasts may only get polled every 10-15 minutes. This comes out to around 1.5 - 2 billion web requests per month.

It is important when you are making your feed requests that you set your last-modified and etag headers. These will speed up your requests significantly by having the servers send you a Not Modified (304) response if nothing has changed since your last poll. Something like 60% of the feeds support this.

You'll also want to keep a hash of the feed content. That way, when you get back a 200 response with the feed contents you can do a quick check to see if the feed content has changed since your last poll (for those servers that don't support etag). This will even further reduce the number of feeds you need to actually parse.

For those that returned a 200, and had a different hash, you now need to parse the feeds. There are a large number of podcasts which insert dynamic data into their feed. Some insert dynamic tracking query items into feed items. Or they make the some of the RSS feed dates the current time stamp (which is incorrect). These feeds with dynamic data will have to be fully parsed every time, which is a bummer. I've considered a future enhancement to my crawler that detects the feeds that do this and flip a bozo bit on them so I poll them less frequently.

The majority of podcast feeds are RSS 2.0. I'd have to check, but I think Parsing these feeds robustly is a whole topic unto itself. Many RSS/XML parsers are very strict. However, for this use case you don't want strictness. You want to extract the info out of the maximum number of feeds possible, even if some of them are malformed in some way. Perhaps the user didn't properly specify an XML namespace they are using. Or they are missing a closing tag for an element, etc.

Because the RSS spec doesn't require a GUID for items in the feed, you have to come up with your own algorithm for matching items with your new feed response. Many articles will tell you to use GUID if available, and if not, use Link. Or some combination of the above. However, for podcasts, you can almost always be assured that a podcast will have a url to the media file. So, I suggest using that as part of your matching algorithm in the absence of a GUID.

I plan on writing a more detailed article on this project as I get closer to finishing my crawler and submitting it to HN. As a further constraint, I'm attempting to get the monthly hosting costs for my distributed crawler to around $100/mo and it be capable of updating every podcast feed every 5 minutes.

Re: How to crawl a quarter billion webpages in 40 hours (2012)

#22
post #9

Earlier quoted context omitted.

> I wonder how this is legal and considered acceptable. I wish I knew how Google and others gets away with scraping content [...] Well, here's the answer: "transformative" reuse of content is explicitly permitted under copyright law. Simply reproducing the content and charging for it would not fall under this provision, but building an archive of publicly available information is - quite appropriately, permissible. T…

I don't think "Sharing is good" is true in the real world. If you apply that as a blanket statement, you'll end up in trouble. What is legal is not always ethical. I think there's an interesting story there about how Google is legal, if someone doesn't automatically assume it should be just because it is. The text online isn't always similar to a published text of the past. There is a personal overlap today that chan…

A lot of this kind of thing in the "real world" is managed by social convention. People understand that there is a difference based on context, that can not fully be captured by the law. For example it may be perfectly legal to take photos of strangers at the beach, but we all understand why that is creepy.

The thing is that on the world wide web the social convention is strongly in favour of being able to slurp up data, at least as long as it does not cause technical problems. Mostly people get this and understand it.

Other apps have emerged that follow different social conventions. For example if you share something on SnapChat you are suggesting that the information should be ephemeral. But you can't expect people/crawlers to infer the context without having that strong hint.

Re: How to crawl a quarter billion webpages in 40 hours (2012)

#23
post #3

Earlier quoted context omitted.

Do you have any recommendations on crawling / detecting changes on a large set of data? For example, the RSS feeds for every podcast on the planet?

This has been my personal project for the past few months. There are around 240k podcasts in the iTunes index and it is fairly trivial to scrape their feed urls. Most of the podcast apps that have feed crawler backends (Pocket Casts, Overcast, etc) poll all 240k podcast feeds fairly frequently. More popular podcasts are polled on the order of every 2-3 minutes while less popular podcasts may only get polled every 10-…

Please please please donate your invaluable collection to archive.org!

Re: How to crawl a quarter billion webpages in 40 hours (2012)

#24
post #9

Earlier quoted context omitted.

> I wonder how this is legal and considered acceptable. I wish I knew how Google and others gets away with scraping content [...] Well, here's the answer: "transformative" reuse of content is explicitly permitted under copyright law. Simply reproducing the content and charging for it would not fall under this provision, but building an archive of publicly available information is - quite appropriately, permissible. T…

I don't think "Sharing is good" is true in the real world. If you apply that as a blanket statement, you'll end up in trouble. What is legal is not always ethical. I think there's an interesting story there about how Google is legal, if someone doesn't automatically assume it should be just because it is. The text online isn't always similar to a published text of the past. There is a personal overlap today that chan…

> "These all seem like parasites to me."

Your impression is wrong. Search engines and other services based on web data provide great value to society. They don't create documents they link to, but they deliver relevant links to people's queries. That's a great service. Without the search engine service, people may not even find the web page. That's why large portion of website owners and webmasters are glad search engine crawlers visit them and even expect indexing to databases to be fast and smooth.

If you publish anything on your web, you're facilitating free use and duplication of it in the whole world. If this was not your intention, but you still published your stuff on your web, you misunderstood the original intent and reality of the Web for sharing information.

There is a widely known standard of communication between robots and web sites called robots.txt standard. It is a file where you can state your intent to restrict crawler downloads. There is also html tag that signalizes to crawlers your wish that the page should not appear in search engine results. If you want to prevent people from accessing and using your documents, use these. Both Google and Common Crawl seem to obey them. If you want to _make_sure_ nobody accesses and uses your documents, don't publish them on the Web.

There is no practical way to achieve your documents are accessible only for some limited period you want. If you release them to the world, you always lose control over their distribution and use.

Re: How to crawl a quarter billion webpages in 40 hours (2012)

#25
post #9

Earlier quoted context omitted.

> I wonder how this is legal and considered acceptable. I wish I knew how Google and others gets away with scraping content [...] Well, here's the answer: "transformative" reuse of content is explicitly permitted under copyright law. Simply reproducing the content and charging for it would not fall under this provision, but building an archive of publicly available information is - quite appropriately, permissible. T…

I believe the Internet Archive is much less clear in this regard than public search engines. IA doesn't even have a clear takedown policy and no webmaster tools in place to give owners control on the archived content. Their crowler does obey to robots.txt rules but if you want content to be removed permanently you have to ask politely by email and in my experience they simply block the site urls from being searched b…

I think the idea of intentionally deleting content is pretty foreign to the Internet Archive. They're more likely to say "welcome to oblivion!" and set a timer for 70 years to show the content again.
Post reply on HN