EDIT: I found a source willing to help, all I had to do was replace this:
$('ul').each(function(){
With this:
$('#Effect').parent().next('ul').find('li').each(function(){
Not too long ago I got the idea for a feature I wanted to add to my Discord bot, it being the ability to list the effects of any given Binding of Isaac item.
Example:
Input: !item teleport
Output: Effect(s): Upon activation, teleports Isaac to a random room on the current floor.
I want the bot to get the information from The Binding of Isaac wiki and so far I've been able to log all content from the "mw-parser-output" class but I'm not too sure how to filter out the parts that I want. In this case it seems to be the first ul.
I'm still quite new to coding and I barely have any HTML experience but with a bit of help from others, this is the code I've gotten so far:
// Get website body
needle.get(wikiLink, (err, res) => {
// Read the html body
var $ = cheerio.load(res.body, {decodeEntities: false});
// Parse the correct class and all uls?
var title = $('.mw-parser-output').text();
$('ul').each(function(){
console.log($(this).text());
})
});
Any help is appreciated. Thanks in advance.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…