简体   繁体   中英

Empty object x-ray scraper in node.js not working

I want to get the first link of the result of here http://search.azlyrics.com/search.php?q=tired+adele

using x-ray node.js scraper . And my code as below :

x('http://search.azlyrics.com/search.php?q=tired+adele', {
    link: x('body > div.container.main-page > div > div > div > table > tbody > tr:nth-child(1) > td > a')
})(function(err, data){
    console.log(data);
});

Not sure why I got empty object. The selector seems doesn't work.

there is no tbody in the source html. remove it from your code and it will work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM