How to Crawl the Web Politely with Scrapy
blog.scrapinghub.com
blog.scrapinghub.com
If memory serves, the frequency was computed for clusters of pages from the same site, and it depended on how often they were updated(news sites front-pages were in practice different in successive updates, whereas e.g users homepage were not, they rarely were updated), and how resilient the sites were to aggressive indexing (if they ‘d fail or timeout, or it ‘d take longer than expected to download the page contents than what we expected based on site-wide aggregated metrics, we ‘d adjust the frequency, etc).
The crawlers were all draining multiple queues, whereas URLs from the same site would always end up on the same queue(via consistent hashing, based on the hostname’s hash), so a single crawler process was responsible for throttling requests and respecting robots.txt rules for any single site, without need for cross-crawler state synchronisation.
In practice this worked quite well. Also, this was before Google and its PageRank and social networks (we ‘d probably have also considered pages popularity based on PageRank like metrics and social ‘signals’ in the frequency computation, among other variables).
http://www.bing.com/search?q=%22We+have+been+receiving+a+lar...
I agree that crawl-delay is rare, and often it's set too long so that it's impossible to fully crawl a site -- as if the webmaster set it up 10 years ago and never updated it as their site got faster and bigger.
As for robots.txt problem is most sites don’t even have one. Especially e-commerce sites. They also don’t have a sitemap.xml in case you don’t want to hit every url just to find the structure of the site. Being polite in many cases takes a considerable effort.
And yes, crawling politely requires a bit of effort from both ends: the crawler and the website.
We need a modern law addressing these issues instead of the pre-Internet CFAA. Malicious actors should still be punished, and it may be reasonable to still allow a provision for the civil liability (not criminal) of large-scale accidental DoS from poorly-implemented scrapers, but users should be free to choose their own browsing devices -- even if those browsing devices are highly optimized to extract only the specific pieces of data that the user cares about.
This law should also clarify that normal communication over HTTP cannot be punished unless the plaintiff can demonstrate real and serious interruption to their services, that local RAM copies that are never externally transmitted cannot be considered infringing in themselves, that hosting a site on the internet grants an implied copyright license to read and access its content with any HTTP-capable client, and that browsewrap/clickwrap contracts are unenforceable unless the user undertakes a significant relationship with the company, among other things.
I honestly don't know how to construct an argument for this because it's so obvious to me.
It's not unethical for a beggar to continue asking for change. It's up to the passerbys to choose whether or not they'll honor his request, but he is free to make it as long as he doesn't get out of control. Many people see the client-server relationship that exists online similarly. As the beggar can't receive anything that the giver doesn't willingly give, neither can the client receive anything the server doesn't willingly give.
It wouldn't make any sense if a guy could give the beggar change and then sue him and say that he shouldn't have gotten change because he actually wanted to use it for his lunch. The judge would say, "Well, why did you give it away? You can't just change your mind and then sue someone over it." This is also what judges should ask servers who dispense information to clients and then try to take it back.
tl;dr there's no harm in asking for data, even after someone has told you no, as long as you do so reasonably.
Instead of fighting against scrapers that don't want to harm you, maybe it's about time to invest in your robots.txt and cooperate.
You could say that scraping you're website is FORBIDDEN, but come on : if Airbnb can rent houses, I can scrap you site.
Unfortunately, if you're scraping some data that only has one authoritative data source, they'll know you're scraping them even if they can't distinguish your individual requests from the general traffic.
This is what happened to my company. It didn't stop them from pretending that we were setting their servers on fire, even though they had no way to know whether we were or not since they couldn't distinguish our traffic from that generated by other browsers.
We were scraping only factual data in the which the company cannot hold a copyright interest. Nonetheless, under Ticketmaster v. RMG, just holding a copy of a page in RAM long enough to parse it constitutes infringement (you have to prove fair use, as Google supposedly did in Perfect 10 v. Google, to avoid this).
The difference between yourself and Google/airbnb is that the latter have a lot of money and are trendy technology companies, and you don't and aren't (yet).
The lesson is become really big before someone sues you and the judiciary will be on your side.
How would they know you're scraping them?
Surely the capability of any given website admin to detect a particular scraper would depend on many factors such as whether they're even looking for scrapers or are technologically capable of doing so, how many/which IPs the scraping is originating from, and how cleverly the scraper goes about their scraping, no?
It's a bit of a cat and mouse game, wouldn't you say?
As for the game of cat and mouse, it lasts until they call in their lawyers. Then it's a game of "quit now or get destroyed".
But yes, if you can scrape the data without ever tipping off the company you're scraping, you can probably continue indefinitely, but you have to consider whether you can plausibly argue that you're getting that data from someplace else. If they sued you on the suspicion that you're scraping them, they'll probably subpoena the code to confirm that (or similar -- IANAL), and then proceed to try to make a case on things other than CFAA violations.
Not every scraper has publishing or using data in a detectable way as their motive.
For instance, I sometimes scrape a website to make an archive of it for my own personal use. I never publish the results or use them in any way that the website owners would ever know about. So the only way they could know that they were scraped is if I left some kind of scraping signature while scraping (such as scraping from a single IP and doing it quick enough to pop on their radar or perhaps regularly enough -- ie. without random waits between request, etc).
What you're talking about is probably mostly a concern to people/companies who are somehow making money from scraping data on other people's websites.
Another thing we noticed is that google's crawler is kind of aggressive, I guess they are in a position to do it.
Our paper in case someone is interested: Optimizing Apache Nutch for domain specific crawling at large scale (http://ieeexplore.ieee.org/document/7363976/?arnumber=736397...)
There goes all Linkedin + Yelp content from your index.
..and medium-sized/small sites are even worse.
The irony of Facebook being a core part of all NSA surveillance programs and their terms of service including their "Automated Data Collection Terms" https://www.facebook.com/apps/site_scraping_tos_terms.php
Yelp was very responsive when blekko wrote them; as you can see ScoutJet has the same access as googlebot.
I think data should be disseminated and free info exchange is great. If possible, devs should respect website owners as much as possible; although in my experience people seem to be more willing to rip off large "faceless" sites rather than mom&&pops. Both because that is where valuable data is, and it seems more justifiable even if morally gray.
Regardless, the thing I find most interesting is that Google is most often criticized for selling user data/out their users privacy. However, it is oft not mentioned that Googlebot & the army of chrome browsers are not only permitted, but encouraged to crawl all sites except a scant few that gave achieved escape velocity. Sites that wish to protect their data must disallow and forcibly stop most crawlers except google, otherwise they will be unranked. This creates an odd dichotomy where not only does google retain massive leverage, but another search engine or aggregator has more hurdles and less resources to compete.
[1] They protect crunchbase and many media companies.
It's a bit more "raw" than Scrapinghub but full featured and cheap.
Disclaimer: I'm the author!