Is there a jQuery webscraper out there?
-
22-09-2019 - |
Question
I'm trying to pullout some info from an external site using jQuery and Adobe AIR. Right now I'm using a hidden div
and jQuery's load function to load fragments of the external site, once the info is loaded I parse some info with selectors. This is fine but it's kinda dirty and I need to perform this several times (don't want to need many hidden divs).
Just wondering if anybody knows a good webscrapper written in jQuery or maybe another method I'm missing
Solution
You can simply call $.ajax
, then create a detached DOM tree by writing $(responseHTML)
.
OTHER TIPS
You can use selectors directly on the ajax response body:
$.get('http://somewhere.com', '',
function (html) {
var scrapedElement = $("#myelement", html);
}
);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow