0
我試圖在URL變量中的頁面上標記li標籤中包含的URL。它應該很簡單,但我無法讓它工作。我得到正確數量的元素,但它們都是空白的。 text()返回''& html()返回null。我在這裏做錯了什麼?NodeJS Cheerio Scraping li標籤總是返回NULL
const cheerio = require('cheerio');
const request = require('request');
function getHistory(){
let url = 'http://coinmarketcap.com/historical/';
request(url,(error,response,html)=>{
var $ = cheerio.load(html);
$('li.text-center').each((i,element)=>{
var omg = $(this).html();
console.log(omg);
});
});
}
謝謝你的朋友,你救了我幾個小時的挫折! – Raven
OMG,非常有幫助! –