cheerio


how to extract info in this kind of html using cheerio?


I got a html as follow, also the code to extract two info, namely: Info123 and '123, abc', $(el).children('span').text() returns 'Info123', but how to extract '123, abc'? thanks
"use strict";
let s = `
<div class="info">
<SPAN title="inf">Info123</SPAN> 123, abc
</div>
`
var cheerio = require('cheerio'),
$ = cheerio.load(s);
$('.info').each(function(i, el) {
console.log($(el).children('span').text()) // get Info123
console.log($(el).text()) // get Info123 123, abc
})

Related Links

confused about cheerio nextUntil
Get the text of the current node only
Accessing the text of a class that contains other elements using Cheerio
cheerio reading children of script tag
how to extract info in this kind of html using cheerio?
Cheerio not finding table content

Categories

HOME
gridview
awk
apache-jena
android-studio-2.2
interface
static-site
entity-framework-core
rom
emscripten
web-hosting
hpc
vsm
python-multithreading
gluon-mobile
qpython
windows-ce
why3
android-intent
event-sourcing
intershop
bourbon
enterprise-miner
exploit
resourcebundle
beta
inversion-of-control
soot
tpm
comparable
carrierwave
sqlpackage
userdefaults
postback
weather
sql-server-2000
wacom
card.io
contacts
vue-chartjs
yowsup
hivemq
lint
xdocreport
password-protection
apns-php
demo
metawidget
signals-slots
odoo-website
openrasta
chai-as-promised
x-ray
pair-programming
truezip
headless
filehandle
skin
type-theory
mouseleave
gets
webjars
grass
decimalformat
assertion
fiware-monitoring
ember-cli-rails
zscript
keyup
osc
exceldatareader
browserify-shim
addressing-mode
create.js
jqmodal
personalization
xml-dsig
conditionaltagsupport
ora-06550
http-patch
script#
rolify
poker
pagedown
cascadingdropdown
mysql-error-2013
swfobject
twisted.web
intersect
redis-py
iboutlet
stress
u2netdk
inline-formset
windows-identity
leader

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App