Help Pharo pass through to Cloudflare guarded website.
Background discussed at blog.openinworld.com
I gather the magic keys required to enter a Cloudflare guarded site. Give me a URL to knock on, and I'll return a factory for generating ZnClients configured with the magic keys.
cloudscraper is a nodejs library. Its where the magic happens to obtain the Cloudflare keys.
OSProcess is used to shell out to nodejs.
knockURL: aHostUrlString provides the url used for initial access.
client returns a new ZnClient configured with the magic keys.
|client response|
client := (CloudflareUn knockUrl: 'http://bittrex.com') client.
client url: 'https://bittrex.com/home/markets'.
(response := client get) inspect.
"Note: Cloudflare enforces a five second delay, so unless you fork, expect UI to block for 5 to 10 seconds"
On Ubuntu 16.04...
$ sudo apt-get update
$ sudo apt-get install nodejs
$ sudo apt-get install npm
$ npm install cloudscraper
In Pharo 6 or 7...
- Start Iceberg, click <Clone repository> and fill in the following details, then click <Create repository>
Remote URL = [email protected]:Traadh/cloudflareun.git
Local directory = (use default)
Code subdirectory = src
-
In Iceberg main panel, click on "clourdflareun", then its [pacakges] tab. You'll see "CloudflareUn" status "Not loaded". Right-click on it and select <Load package>
-
Since there is not yet a Baseline, in Playground evaluate...
CloudflareUn installOSProcess -
Verify requirements, in Playground evaluate...
CloudflareUn checkInstallNodeJs