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
service-worker
gridview
fuelux
fpga
css3
camera
error-handling
rendering
parameters
x264
spring-session
openstreetmap
mod-security
google-form
atlassian
standards
mathprog
vuejs
oledb
selinux
dynamically-generated
jquery-multiselect
android-maps
underscore.js
8051
sinch
subclass
iis-express
database-comparison
dumpbin
memory-address
getlasterror
reason
docfx
alphabetical
ods
chef-solo
c9.io
news
levenshtein-distance
portforwarding
bindingnavigator
angular-http
textsum
geotiff
tinkerpop
sundials
rackspace-cloud
template-toolkit
smartfoxserver
usart
reporting-services-2012
hadoop-2.7.2
async.js
eigenvector
appscale
qiime
omniauth-facebook
angular-ui-typeahead
php-socket
kiosk
ascii-art
crouton-os
spring-retry
google-books
phonertc
page.js
.bash-profile
baasbox
canvg
mraid
formview
android-framework
vbe
rfc5322
scriptaculous
cocoalibspotify-2.0
gpars
flex++
jquery-1.9
stacky
http-status-code-410
intersect
onmousemove
boost-msm
lambdaj
appjs
jdb
usertype
jsr286
pylucene
socketserver
twitterizer
svk
globals
isapi-extension
linfu-dynamicproxy

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