cheerio中文API

const cheerio=require('cheerio')
let a=
`
  • Apple
  • Orange
  • Pear
` $ = cheerio.load(a) const text=$('#fruits').text() const html=$('#fruits').html() const id=$('#fruits').attr('id') console.log(text) // Apple // Orange // Pear console.log(html) //
  • Apple
  • //
  • Orange
  • //
  • Pear
  • console.log(id) // fruits

    更多
    https://cnodejs.org/topic/5203a71844e76d216a727d2e

    你可能感兴趣的:(cheerio中文API)