node.js - Scraping with phantomJS and NodeJS -


I am following the tutorial listed here:

When I Code for:

  var host = 'http://www.shoutcast.com/?action=sub&cat=Hindi#134'; Var Fatam = Requirement ('Phantom'); Phantom.create {return ph.create page (function) {return page} open (host, function) {console.log ("open site?", Position); page.injectJs (' Http: //ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js', function () // // Load something on AJAX content for loading on // page Wait for, here we are waiting for 5 seconds setTimeout (function () {return page.evaluate (function () {// what you want from jQuery page.) Populate a good way object with all the jQuery commands Brace Log (document.getElementsByClassName ('Infection') [0]); Return Document .getElementsByClassName ('Infection') [0];}, Function (Results) {console.log (Results); Ph.exit (); });}, 5000);})}});});});  

I get the following error:

  Phantom stdout: Reference error: Can not find variable: $ phantom stdout: phantomjs: //webpage.evaluate (): 7 Prematmas: // Whatsapp.Evilweight (): 10 Phautomas: // web page. Avaluate (): 10 I do not know what it means and there is no help in it, solve it ... how can this be resolved?  

Actually I want all the 'A' tags from the site that I am scrapping with class transition. Asynchronous loads are loaded on all these tag sites.

$ is due to jQuery and potential conflicts you just do not necessarily just jquery Need to scrap the 'A' tag with the class transition . You always have document.querySelector or document.querySelectorAll .

  var host = 'http://www.shoutcast.com/? Action = sub & amp; Cat = Hindi # 134; Var Fatam = Requirement ('Phantom'); Phantom.create {PHP.createPage (function (page) {page.open (host, function (status) {console.log ("site opened?", Position); // a little late for AJAX Wait for the content to be loaded on the page here, we are waiting 5 seconds. SetTimeout (function () {page.evaluate (function () {// Here you get html / text // more code Need to add more code Use the query Selector all return document.document.querySelector ('a.transition'); // Return document.document.querySelectorAll ('a.transition');} Kshn (result) {console.log (result); ph.exit ();});}, 5000);});});});  

However, I am not able to understand the function (result) {console.log (results); ...} is coded I do not know if page Latent takes the callback function as the second parameter, please check with that document.


Comments