Skip to content

Instantly share code, notes, and snippets.

@knyga
Created March 14, 2014 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knyga/9558652 to your computer and use it in GitHub Desktop.
Save knyga/9558652 to your computer and use it in GitHub Desktop.
Freelansim.ru, get emails by keyword [outofdate]
var request = "http://freelansim.ru/freelancers?freeonly=true&page=<?%page%?>&q=ruby+on+rails",
pcount = $('.gap').next().text() || 5,
emails = [];
var stat = {
cur: 0,
total: 0,
left: function() {
return this.total - this.cur;
}
};
for (var i = 1; i <= pcount; i++) {
//$('.name a').length
$.get(request.replace('<?%page%?>', i), function(cat) {
stat.total += $('.name a', cat).each(function() {
var href = $(this).attr('href');
$.get(href, function(data) {
var pat = /\<a.+?class="mail".+?data-mail-host="(.+?)".+?data-mail-name="(.+?)".+?\>/.exec(data);
if (pat.length > 2) emails.push(pat[2] + "@" + pat[1]);
++stat.cur;
});
}).length;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment