Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
347 views
in Technique[技术] by (71.8m points)

discord.js - How to fetch div tags and classes from html website with node-fetch and cheerio?

How to fetch div tags and classes from html website?

client.on('message', async(message, user, args) =>{
    if (message.content === '?groja'){
        let url = "https://zipfm.lt";
        fetch(url).then(res => res.text())
        .then(html => {
            const parse = cheerio.load(html)
            console.log(parse("meta[property='og:description']")[0].attribs.content)
        })
    }
})

How to fetch this div from website? <div id="ldr" class="daina-eteryje"><div id="song_author" class="atlikejas">JUSTIN JESSO, SEEB</div><div id="song_title" class="daina">Bigger Than</div></div>

Is it possible to only use class and id? I want to make a command - if the user uses the command, he gets up-date atlikejas and daina


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...