Created
March 14, 2014 22:50
-
-
Save knyga/9558652 to your computer and use it in GitHub Desktop.
Freelansim.ru, get emails by keyword [outofdate]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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