簡體   English   中英

我可以使用node.js cherrio解析器從espncricinfo獲得單個玩家的實時分數嗎

[英]can i get the scores of the individual players live from espncricinfo using node.js cherrio parser

我正在嘗試獲取單個玩家的實時比分以及espncricinfo的比分,但我無法檢索到它:

我只得到一些數據,而不是分數,因為數據是動態變化的,這就是我無法獲得這些數據的原因。

我的node.js代碼如下:

 app.get('/scrape', function(req, res){
url = 'http://www.espncricinfo.com/indian-premier-league
              -2014/engine/match/733985.html';

request(url, function(error, response, html){
    if(!error){
        var $ = cheerio.load(html);
        $('td.batsman-name').filter(function(){
                var data = $(this);
                console.log("Hi Entered");
                console.log(data.text());
        })
     }

但是我沒有結果。

在我看來,您所連接的網站會動態加載您要抓取的數據,因此您很可能在不完整的html上使用cheerio。 您可能會弄清楚他們用來向其數據加載信息的URL,然后將其抓取。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM