Skip to content

Instantly share code, notes, and snippets.

@jamlfy
Created May 23, 2015 23:29
Show Gist options
  • Save jamlfy/a09c6e2a07e19eae6fad to your computer and use it in GitHub Desktop.
Save jamlfy/a09c6e2a07e19eae6fad to your computer and use it in GitHub Desktop.
Bitcoin Free
#!/bin/env node
// vfukksrevjoarnql
const file = 'FILE';
const ram = NaN;
const _ = require('underscore');
const path = require('path');
const fs = require('fs');
const Browser = require('zombie');
const async = require('async');
const image = '.content-section-b .col-lg-5.col-lg-offset-1.col-sm-push-6.col-sm-6 > p.lead > img';
const buttom = 'input.btn.btn-default.btn-lg[value="Start"]';
const matchs = /Completing\s[0-9]{1,3}\sminutes/i;
const replaces = /img|\/|\.png|\s|Completing|minutes/ig;
var json = require(file);
var list = _.sample(json.ok, ram);
async.map(list, function (bitcoin, callback) {
var browser = new Browser();
browser.visit('http://www.coinlearn.org/', function () {
browser
.fill('input[name=addr]', bitcoin)
.select('select[name=haveaddr]', 'yes')
.pressButton(buttom, function() {
var num = browser.text('.lead').match( matchs )[0].replace(replaces, '');
var img = browser.query(image)._attributes.src._nodeValue.replace(replaces, '');
var name = '';
var time = (parseInt(num) * 60 * 1000 ) + ( _.random(10, 50) * 100);
if (img === '1' )
name = 'Satoshi Nakamoto';
if (img === '2' )
name = 'Blockchain';
if (img === '3' )
name = 'Bitcoin';
if (img === '4' )
name = 'Chotku';
if (img === '5' )
name = 'Tatu';
if (img === '6' )
name = 'Puchki';
if (img === '7' )
name = 'Bhutu';
if (img === '8' )
name = 'Kalipado';
var timer = setTimeout(function() {
browser
.fill('input[name=picture]', name)
.pressButton(buttom, callback);
}, time);
});
});
}, function (err) {
if(err) console.error(err);
json.ok = _.diference(json.ok, list);
fs.writeFile(file, json, function (err) {
if (err) throw err;
process.exit();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment