简体   繁体   English

node.js 中的空对象 X 射线刮刀不起作用

[英]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我想得到这里http://search.azlyrics.com/search.php?q=tired+adele结果的第一个链接

using x-ray node.js scraper .使用x 射线 node.js 刮刀 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.源 html 中没有 tbody。 remove it from your code and it will work从您的代码中删除它,它将起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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