News for hackers. Stuff that matters.
Re:Web Scraping in 2016 by fake-name on Tuesday August 23, 2016 @02:55PM (#12346441)
I do a significant amount of scraping for hobby projects, albeit mostly open websites. As a result, I've gotten pretty good a circumventing rate-limiting and most other controls.

I suspect I'm one of those bad people your parents tell you to avoid - by that I mean I completely ignore robots.txt.

At this point, my architecture has settled on a distributed RPC system with a rotating swarm of clients. I use RabbitMQ for message passing middleware, SaltStack for automated VM provisioning, and python everywhere for everything else. Using some randomization, and a list of the top n user agents, I can randomly generate about ~800K unique but valid-looking UAs. Selenium+PhantomJS gets you through non-capcha cloudflare. Backing storage is Postgres.

Database triggers do row versioning, and I wind up with what is basically a mini internet-archive of my own, with periodic snapshots of a site over time. Additionally, I have a readability-like processing layer that re-writes the page content in hopes of making the resulting layout actually pleasant to read on, with pluggable rulesets that determine page element decomposition.

At this point, I have a system that is, as far as I can tell, definitionally a botnet. The only things is I actually pay for the hosts.

---

Scaling something like this up to high volume is really an interesting challenge. My hosts are physically distributed, and just maintaining the RabbitMQ socket links is hard. I've actually had to do some hacking on the RabbitMQ library to let it handle the various ways I've seen a socket get wedged, and I still have some reliability issues in the SaltStack-DigitalOcean interface where VM creation gets stuck in a infinite loop, leading to me bleeding all my hosts. I also had to implement my own message fragmentation on top of RabbitMQ, because literally no AMQP library I found could reliably handle large (>100K) messages without eventually wedging.

There are other fun problems too, like the fact that I have a postgres database that's ~700 GB in size, which means you have to spend time considering your DB design and doing query optimization too. I apparently have big data problems in my bedroom (My home servers are in my bedroom closet).

---

It's all on github, FWIW:

Manager: https://github.com/fake-name/ReadableWebProxy

Agent and salt scheduler: https://github.com/fake-name/AutoTriever

Re:Web Scraping in 2016 by kough on Tuesday August 23, 2016 @04:26PM (#12347269)
Yet another incredible technical achievement due to someone's quest for more porn (https://github.com/fake-name/AutoTriever/blob/master/setting...).
Re:Web Scraping in 2016 by fake-name on Tuesday August 23, 2016 @05:22PM (#12347783)
That's a separate project:

- https://github.com/fake-name/ExHentai-Archival

- https://github.com/fake-name/PatreonArchiver

- https://github.com/fake-name/xA-Scraper

- https://github.com/fake-name/DanbooruScraper

Or... well, 4 separate projects. Whoops?

At one point, a friend and I were looking at trying to basically replicate the google deep-dream neural net thing, only with a training set of porn. It turns out getting a well tagged dataset for training is somewhat challenging.

Well-tagged hentai is trivially accessible, though. I think there's probably a paper or two in there about the demographics of the two fan groups. People are fascinating.

Next up, automate the consumption too!

Re:Web Scraping in 2016 by someuser18 on Wednesday August 24, 2016 @03:53AM (#12350439)
At least Ex supports torrents and also has some custom p2p software which you can run (serves content) from which data can be siphoned off.

And what is served through their website is resized. So web-scraping is an inferior approach.

Re:Web Scraping in 2016 by fake-name on Wednesday August 24, 2016 @04:33PM (#12355023)
You seem to be assuming

1. I'm scraping the resized galleries.

2. I don't have the Hath perk that makes the galleries full sized.

3. I don't have a phash-based fuzzy image deduplication system on top of all this (see https://github.com/fake-name/IntraArchiveDeduplicator). It's main purpose is to deduplicate manga (https://github.com/fake-name/MangaCMS).

Re:Web Scraping in 2016 by ycombinatorMan on Saturday August 27, 2016 @03:33PM (#12373805)
Jesus, your projects are massive. Does your job involve working on these or are these just side things?
Re:Web Scraping in 2016 by fake-name on Tuesday August 30, 2016 @04:26PM (#12393568)
It's all entirely hobby things.
Re:Web Scraping in 2016 by andai on Thursday August 25, 2016 @08:56PM (#12363606)
Oh my god. Can you share any results?
Re:Web Scraping in 2016 by fake-name on Tuesday August 30, 2016 @04:27PM (#12393577)
The project never went anywhere, unfortunately, and I haven't had time to look at it recently.

I have huge, uh, "datasets" around still, though.

Re:Web Scraping in 2016 by clevernickname on Tuesday August 23, 2016 @08:49PM (#12348921)
You're doing god's work.
Re:Web Scraping in 2016 by monsoon22 on Tuesday August 23, 2016 @03:24PM (#12346693)
How do you circumvent cloud provider IP blocks? For example, one site blocks all requests from AWS EC2 servers.
Re:Web Scraping in 2016 by fake-name on Tuesday August 23, 2016 @03:28PM (#12346735)
None of the sites I'm scraping do that, mostly.

I'm not scraping high value sites like that (I mostly target amateur original content). It's not really of interest to other businesses. As such, I tend to just run into things like normal cloud-flare wrapped sites, and one place that tried to detect bots and return intentionally garbled data.

If I run into that sort of thing, I guess we'll see.

Re:Web Scraping in 2016 by nickysielicki on Wednesday August 24, 2016 @05:14PM (#12355304)
I've never used this, and it's incredibly shady considering the users probably do not realize that their Hola browser plugin does this, but Hola runs a paid VPN service where you can get thousands of low-bandwidth connections on unique residential IP addresses, provided generously through their "free" VPN users.... It's essentially a legitimate attempt at running a botnet as a service.

But if the end justifies the means... http://luminati.io/

Re:Web Scraping in 2016 by siegecraft on Tuesday August 23, 2016 @05:22PM (#12347778)
I'm sure there'd be a ton of people that would love to pay to use your platform (who cares if the source is available, I don't want to run my own because once the code is written, it's ops thats hard). But then I suppose it would be hard to stay unnoticed.
Re:Web Scraping in 2016 by fake-name on Tuesday August 23, 2016 @06:12PM (#12348193)
Yeah, running this thing publicly would be a huge mess from a copyright perspective, since it literally re-hosts everything as a core part of how it works.

As it is, I think I'm OK, since it's basically just a "website DVR" type thing, for my own use.

Really, if nothing else, the project has been enormously educational for me. I've learnt a boatload about distributed systems, learned a bit of SQL, dicked about with databases a bunch, and actually experienced deploying a complex multi-component application across multiple disparate data centers.

Re:Web Scraping in 2016 by nickysielicki on Tuesday August 23, 2016 @08:41PM (#12348900)
This project is really cool. Last year I was looking into open source projects that implement something like Readability so that I could scrape articles from my RSS feeds and turn them into plaintext. But I didn't find anything that blew me away. The best I got was stealing the implementation from Firefox, and I lost interest before I could make it worthwhile. (Now revisiting the idea, I wonder why I never thought of passing a user-agent from a mobile browser... Probably would have helped a lot.)

I see you don't have a license listed on GitHub. Do you have a license in mind for these?

Re:Web Scraping in 2016 by fake-name on Tuesday August 23, 2016 @09:04PM (#12348961)
It's probably GPL, I'll have to figure out my dependencies and see what it's infected with. I tend to err BSD on my own cruft.

This isn't quite as fancy as readability, though I integrated a port of readability for a while. Now I just write a ruleset for a site that has stuff that interests me.

Re:Web Scraping in 2016 by fake-name on Thursday August 25, 2016 @01:33PM (#12360846)
Note: I stuck it under BSD license.
Re:Web Scraping in 2016 by atmosx on Tuesday August 23, 2016 @08:30PM (#12348865)
Similar, paid solution: https://scrapinghub.com/crawlera/
Re:Web Scraping in 2016 by uptown on Tuesday August 23, 2016 @11:20PM (#12349448)
What would the rough costs be to run the 800k UA scenario?
Re:Web Scraping in 2016 by fake-name on Wednesday August 24, 2016 @04:34PM (#12355041)
To be clear, I have a pool of 800K theoretical UAs derived from the mechanism I use to generate them, not 800K clients.

Regarding costs, I really have no idea. It depends on how rapidly you cycle the UA, and how fast whatever you're scraping is.

Re:Web Scraping in 2016 by franciskim on Tuesday August 23, 2016 @02:57PM (#12346456)
take my money!
Re:Web Scraping in 2016 by Greg-J on Tuesday August 23, 2016 @05:45PM (#12347972)
How can I get ahold of you directly?
Re:Web Scraping in 2016 by fake-name on Tuesday August 23, 2016 @05:58PM (#12348086)
connorw at imaginaryindustries dot com
Re:Web Scraping in 2016 by Greg-J on Tuesday August 23, 2016 @07:37PM (#12348646)
Thanks. Email sent.
Re:Web Scraping in 2016 by chmars on Tuesday August 23, 2016 @03:22PM (#12346665)
Wow, that's impressive!