为什么我总是得到 Null?

Why do I keep getting Null?

const request = require('request');
const cheerio = require('cheerio');

request('https://www.ratemyprofessors.com/ShowRatings.jsp?tid=1985428', (error, response, html) => {
    if(!error && response.statusCode ==200){
        //console.log(html);
        const $ = cheerio.load(html); 
        
        const profTopComment = $('.Comments__StyledComments-dzzyvm-0 dvnRbr');
        
        console.log(profTopComment.html());
    }
});

我正在尝试创建一个 chrome 扩展来从 RatemyProffessor 中抓取数据,但是当我试图从上面的 url 中抓取最有意义的评论时,我总是得到 null,任何帮助都是太棒了!

当我说“获取 Null”时,我的意思是 console.log(profTopComment.html()) 在终端中给我 null。

我正在尝试抓取最有帮助的评分。

  • '.Comments__StyledComments-dzzyvm-0.dvnRbr' 需要第二个 "." 寻找 <div></div> 元素 two 不同的 类
  • 基本上只需将代码中的 '.Comments__StyledComments-dzzyvm-0 dvnRbr' 更改为 '.Comments__StyledComments-dzzyvm-0.dvnRbr'

示例:

const axios = require('axios');
const cheerio = require('cheerio');

async function testFunc() {
  const result = await 
  axios.get('https://www.ratemyprofessors.com/ShowRatings.jsp?tid=1985428');
  const $ = cheerio.load(result.data);
  const profTopComment = $('.Comments__StyledComments-dzzyvm-0.dvnRbr');
  console.log(profTopComment.html());
}
testFunc();