Live data from Hacker News

Ask HN: How are you dealing with scraping hits from EC2 machines?

news.ycombinator.com

21–30 of 42 posts

Re: Ask HN: How are you dealing with scraping hits from EC2 machines?

#21
post #17

Are there known user agents that you can identify as coming from the scrapers? If so, you either block that way and not worry about IP addresses or choose to disable Google Analytics on those requests so it doesn't skew GA data.

As was identified, most of the scraping occurs via Selenium. Selenium just automates a real browser, so it'd look like 100% legit traffic with a legit user agent (it defaults to using Firefox)

Re: Ask HN: How are you dealing with scraping hits from EC2 machines?

#22

Earlier quoted context omitted.

Mostly duplicate content & messing up my analytics (increased bounce rate, decreased time spend on page etc.)

What analytics are you using? I thought most would use javascript to avoid problems like this, and I would wager that the vast majority of bots don't bother executing javascript. You will always have legit bots hitting your site as well.

Selenium executes Javascript, as do other WebKit-based scrapers, like phantom.js.

Re: Ask HN: How are you dealing with scraping hits from EC2 machines?

#23
post #17

Are there known user agents that you can identify as coming from the scrapers? If so, you either block that way and not worry about IP addresses or choose to disable Google Analytics on those requests so it doesn't skew GA data.

As was identified, most of the scraping occurs via Selenium. Selenium just automates a real browser, so it'd look like 100% legit traffic with a legit user agent (it defaults to using Firefox)

So the solution is simple isn't it? Google Analytics filter > filter referers like Selenium (or the entire EC2 block).

Re: Ask HN: How are you dealing with scraping hits from EC2 machines?

#24
post #23

Earlier quoted context omitted.

As was identified, most of the scraping occurs via Selenium. Selenium just automates a real browser, so it'd look like 100% legit traffic with a legit user agent (it defaults to using Firefox)

So the solution is simple isn't it? Google Analytics filter > filter referers like Selenium (or the entire EC2 block).

Not sure how you could filter Selenium. A well written script looks like normal traffic.

Re: Ask HN: How are you dealing with scraping hits from EC2 machines?

#25
I've done a lot of automation with Selenium, on EC2. (For the curious, it was on behalf of clients with legit access, not wholesale pillaging of a public resource)

1) You can block EC2 wholesale. You've mentioned issues with this, and can be bypassed via VPN or using another network. EC2 is attractive because it's so cheap (with spot instances, starts at 0.3 cents per hour), but it's not the only option.

2) Timing. Normal traffic isn't rapid fire. Many scrapers, however, fire off their scripts as quickly as possible. Block traffic that doesn't have enough meaningful pauses.

3) Report addresses to Amazon. I really don't know if they'd take action.

4) Reverse lookup, or whitelist addresses. I know if it's a legitimate source (like Flipboard) they'd probably work with you at least a little bit. Reverse lookup might not be successful, but maybe that can help you whitelist any legit sources that map their AWS IP to a legit DNS name. Most scrapers use the AWS external domain name. Also, I imagine legit sources give you a distinctive user agent, so that can help you let traffic through.

However, if you have a public resource, this is simply an issue you have to deal with. Anayltics: I'd just filter out traffic scraped traffic from your analytics. Content duping: blocking scrapers won't stop this. If someone stealing your content can't scrape at 0.5 cents per hour, they'll pay someone 5 cents an hour to copy/paste. You just have to use the same diligence others use, in terms of reporting to Google, etc. Perfomance: use Varnish/nginx/etc to combat performance hit from scrapers.

Re: Ask HN: How are you dealing with scraping hits from EC2 machines?

#27
If these scrapers abide by robots.txt (you do have a robots.txt, right?) and scrape only whatever you left publicly accessible, then I think you should work on your server performance, because if a scraper causes problems, you'll have much worse problems once whatever you've built becomes popular.

Hunting down bots is a waste of time and effort better spent elsewhere.

Re: Ask HN: How are you dealing with scraping hits from EC2 machines?

#28
There is no silver bullet for stopping web scrapers. If you just try to block User Agents or IPs, all you are doing is putting a small hurdle in their way. You have to employ a lot of different tools to be able to make the wall high enough that they actually stop trying to scrape you. Some of the key things you need to do are:

behavioral modeling - rate limiting, bandwidth restrictions, etc

identity verifications - make sure they are running the browser they say they are, allow google and other search engins by whitelisting their IPs, block others that are pretending to be google, etc

code obfuscation - make it hard for them to scrape your code. Change up the CSS, etc.

OR you can use an automated service to do all this for you. Check out www.distil.it. Full disclosure, I'm the CEO of Distil.

Re: Ask HN: How are you dealing with scraping hits from EC2 machines?

#29

I've done a lot of automation with Selenium, on EC2. (For the curious, it was on behalf of clients with legit access, not wholesale pillaging of a public resource) 1) You can block EC2 wholesale. You've mentioned issues with this, and can be bypassed via VPN or using another network. EC2 is attractive because it's so cheap (with spot instances, starts at 0.3 cents per hour), but it's not the only option. 2) Timing. N…

> 3) Report addresses to Amazon. I really don't know if they'd take action.

They take action. I've seen it done.

Re: Ask HN: How are you dealing with scraping hits from EC2 machines?

#30
post #23

Earlier quoted context omitted.

So the solution is simple isn't it? Google Analytics filter > filter referers like Selenium (or the entire EC2 block).

Not sure how you could filter Selenium. A well written script looks like normal traffic.

A well written scraper looks like normal traffic in the same way that a well written pseudo random number generator looks like a random number generator. It'll fool your eye but not statistical analysis.

Think about the goal of a scraper, it needs to actually walk through all the content. That doesn't look like a normal user at all. An individual request might look ok, but in aggregate the pattern of a robot pops out.

https://www.usenix.org/conference/usenixsecurity12/pubcrawl-...

Post reply on HN