/* * * Dyrk.org 2017 - 2018 * (c) Crawler Linkedin Search Engine * dave-hill [@] dyrk [.] org * */ var d = document, ProfileList = {}, DownloadProfile = function(url){ xhttp = new XMLHttpRequest(), xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var parser = new DOMParser(), doc = parser.parseFromString(this.responseText, "text/html"), decode = d.createElement('textarea'), cds = doc.getElementsByTagName('code'), pf = {"id":url+"","work":{},"school":{}}; for (var i in cds){ try { if (!cds[i].innerHTML) continue; decode.innerHTML = cds[i].innerHTML; datas = JSON.parse(decode.value); for (var j in datas.included){ if (datas.included[j].title) pf.work[datas.included[j].title] = CrawlData(datas.included[j]); else if ((datas.included[j].schoolName)) pf.school[datas.included[j].schoolName] = CrawlData(datas.included[j]); } } catch (e){}; } ProfileList[url] = pf; } }; xhttp.open("GET", url+"", true); xhttp.send(); }, CrawlData = function(arr){ for (var j in arr) if (! /^(locationName|companyName|title|schoolName|degreeName|description)$/.exec(j)) delete arr[j]; return arr; }, GetSearchResult = function(){ var next = d.getElementsByClassName('next-text')[0], res = d.getElementsByTagName('a'), count = 0; if (!next){ for (var i in ProfileList){ var a = document.createElement('a'); a.setAttribute('download', 'linkedinCrawlerByDyrk----'+(/linkedin\.com\/in\/([A-Za-z0-9^_\-]{0,30})\/.*?/.exec(i))[1]+'.json'); a.setAttribute('href', 'data:csv/txt,'+encodeURIComponent(JSON.stringify(ProfileList[i]))); a.click(); } return -1; } for (var i in res){ try { profileUrl = /linkedin\.com\/in\/([A-Za-z0-9^_\-]{0,30})\/.*?/.exec(res[i].href); if (profileUrl) res[i].href = "https://www.linkedin.com/in/"+profileUrl[1]+"/"; if (!profileUrl|| ProfileList[res[i].href]) continue; ProfileList[res[i].href] = []; setTimeout(DownloadProfile.bind(null, res[i].href), 2000 * (count++)); } catch (e){}; } next.click(); setTimeout(GetSearchResult, 2000 * (count+3)) }; GetSearchResult();