Last active
August 29, 2015 14:04
-
-
Save athlan/22fc5ea84dee4e913395 to your computer and use it in GitHub Desktop.
CEIDG grabber
This file contains hidden or 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
// get into: | |
// https://prod.ceidg.gov.pl/CEIDG/ceidg.public.ui/Search.aspx | |
// and go go go! | |
var data = [] | |
var urls = $('#MainContent_DataListEntities').find('a.searchITA').toArray().map(function(o) { return $(o).attr('href') }) | |
urls = $.grep(urls, function(el, index) { | |
return index == $.inArray(el, urls); | |
}); | |
var n = 0 | |
$(urls).each(function(i, url) { | |
$.get(url, function(response) { | |
++n | |
var node = $(response) | |
var email = $('#MainContent_lblEmail > a', node).text() | |
if(email) { | |
var row = [] | |
row.push(email) | |
row.push($('#MainContent_lblFirstName', node).text()) | |
row.push($('#MainContent_lblLastName', node).text()) | |
row.push($('#MainContent_lblName', node).text()) | |
row.push($('#MainContent_lblPlaceOfBusinessAddress', node).text()) | |
data.push(row.join(';')) | |
} | |
console.log('done: ' + n + '/' + urls.length) | |
if(n == urls.length) { | |
var container = $('<div>') | |
container.html($.unique(data).join("<br />")) | |
$('body').append(container) | |
} | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment