Last active
April 29, 2016 05:23
-
-
Save ginos173/9aaef86bc681f876363d to your computer and use it in GitHub Desktop.
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
$ = jQuery; | |
var scrapurl = []; | |
//$("a[target=_blank]").not(".btn").each(function(){ | |
$(".region-content").find("a").not(".btn").each(function(){ | |
var $yo = $(this); | |
scrapurl.push($yo.attr("href")); | |
}) | |
singleScrap(scrapurl,0); | |
var conseguidos = ""; | |
function singleScrap(scrapurl,ind){ | |
if(scrapurl[ind]){ | |
console.log(scrapurl[ind]); | |
$.ajax({ | |
url: scrapurl[ind], | |
success: function(data) { | |
//var pattern = /[a-zA-Z0-9]{2,3}\.+[a-zA-Z0-9]+@[a-zA-Z0-9\._\-]+/i; | |
var pattern = /[a-zA-Z0-9\._\-]+@[a-zA-Z0-9]+\.+[a-zA-Z0-9]{2,3}/i; | |
var codhtml = data; | |
var res= codhtml.match(pattern); | |
if(res && res.length>0){ | |
for(enc=0;enc<res.length;enc++){ | |
//console.log(res[enc]); | |
conseguidos = conseguidos+ res[enc]+", "; | |
} | |
} | |
}, | |
complete: function(){ | |
singleScrap(scrapurl,ind+1); | |
} | |
}); | |
} else if(scrapurl[ind] == ""){ | |
singleScrap(scrapurl,ind+1); | |
} else { | |
console.log(conseguidos); | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment