📜  Cheerio 库来解析 url 中的元标记 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:54.553000             🧑  作者: Mango

代码示例1
request('https://example.com', function (error, response, html) {
  if (!error && response.statusCode == 200) {
    const $ = cheerio.load(html);
      console.log($("meta[property='og:title']").attr("content"));
      //or 
      console.log($("meta").get(1).attr("content")); // index of the meta tag
  }
});