Answer the question
In order to leave comments, you need to log in
How to read text between HTML tags on Node.js(cheerio)?
I am writing a parser. And I need to pull out the line "Reluctant heiress [01-02 of 08] (2018) WEBRip-AVC from Files-x" how to do this?
HTML code:
<a href="/torrent/626682/naslednica-ponevole-01-02-iz-08-2018-webrip-avc-ot-files-x">Наследница поневоле [01-02 из 08] (2018) WEBRip-AVC от Files-x </a>
const request = require('request-promise');
const cheerio = require('cheerio');
request('http://s.new-rutor.org/').then(res => {
const $ = cheerio.load(res)
const links = $('a')
links.each(i => {
const link = links.eq(i).attr('href')
if (link && link.includes('magnet')) {
console.log(link)
}
})
const torrents = $('a')
torrents.each(i=>{
const torrent =torrents.eq(i).attr('href')
if(torrent && torrent.includes('/torrent')) {
console.log("Torrent is here:")
console.log(torrent)
}
})
})
Answer the question
In order to leave comments, you need to log in
This text is not between tags, this is the content of the tag itself.
links.eq(i).html() - isn't it?
Ask questions that are answered in the documentation.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question