Questions tagged [cheerio]

Questions about Cheerio, an implementation of core jQuery designed specifically for the server.

Implementation of core jQuery designed specifically for the server. https://github.com/cheeriojs/cheerio

1350 questions
29
votes
3 answers

Can I load a local html file with the cheerio package in node.js?

I have a few html files on my harddrive that I'd like to use jquery on to extract data from. Is this possible to do using cheerio? I've tried giving cheerio the local path but it doesn't work. One idea I had would be to create a web server in…
Jpaji Rajnish
  • 1,399
  • 2
  • 16
  • 29
21
votes
2 answers

Cheerio: How to select element by text content?

I have some HTML like this: Code: 12345 Category: faucets I want to fetch the category name ("faucets"). This is my trial: var $ = cheerio.load(html.contents); var category =…
MarcoS
  • 15,673
  • 23
  • 78
  • 152
21
votes
1 answer

BeautifulSoup like scraper for nodejs

I am former python developer and I have used BS4 for couple of years Now I am developing with node and yes cheerio package is very good, but I need smth like BS4 for scraping in node Is there some alternatives for cheerio? Thanks!
Jesus_Maria
  • 847
  • 4
  • 11
  • 23
20
votes
2 answers

How do get script content using cheerio

I am using the cheerio lib and am trying to get this script field - script type="application/json" But for some reason it can not find these script tags. What is wrong? How do I fix? var $ = require('cheerio') var parsedHTML =…
CWon
  • 241
  • 1
  • 2
  • 7
19
votes
2 answers

Cheerio Map Strange Behaviour

I'm using map with a list of Cheerio results to return an attribute value. What I want is a variable that contains a list of attribute values (in this case ID's), but instead I'm getting the ID's and extra data. The following code prints a list of…
BugHunterUK
  • 6,765
  • 7
  • 41
  • 94
17
votes
2 answers

Select elements with an attribute with cheerio

What is the most efficient way to select all dom elements that have a certain attribute. With plain javascript I would use : document.querySelectorAll("[name='mode']") or document.querySelectorAll("[name]") if I don't care about…
charly rl
  • 650
  • 2
  • 5
  • 14
17
votes
2 answers

cheerio / jquery selectors: how to get a list of elements in nested div's?

I need to parse some markup similar to this one, from an html page:
MarcoS
  • 15,673
  • 23
  • 78
  • 152
17
votes
2 answers

Node.js Cheerio parser breaks UTF-8 encoding

I parse my request with Cheerio like this: var url = http://shop.nag.ru/catalog/16939.IP-videonablyudenie-OMNY/16944.IP-kamery-OMNY-c-vario-obektivom/16704.OMNY-1000-PRO; request.get(url, function (err, response, body) { console.log(body); $ =…
MeetJoeBlack
  • 2,185
  • 7
  • 29
  • 63
13
votes
2 answers

Async/Await with Request-Promise returns Undefined

I have two files; server.js and scrape.js, below are the code snippets as they currently stand. server.js: const scrape = require("./scrape"); async function start() { const response = await scrape.start(); …
razki
  • 870
  • 2
  • 7
  • 15
13
votes
1 answer

Is it possible to scrape a React website (Instagram) with Cheerio?

I'm trying to scrape Instagram (built with React) with Node.js / Cheerio. Debugging the document shows an object returned, but it doesn't look like the typical response. I'm guessing this has to do with React. Is there a way to get around this, and…
Kyle Chadha
  • 2,719
  • 1
  • 24
  • 37
13
votes
4 answers

Scraping with Meteor.js

Can I scrape with meteor.js? Just discovered cheerio which works excellent combined with request. Can I use these with meteor, or is there something similar? Do you have an working example?
kornfridge
  • 4,774
  • 6
  • 26
  • 39
12
votes
1 answer

Nodejs webpage scraping with authentication cookie

Lately I'm trying to scrape Information from a website (kicktipp) using Nodejs, the request module and cheerio. Since this site requires an authentication to view most of it's sites, I tried to login via a post request and checking if the user is…
mspl
  • 397
  • 4
  • 16
12
votes
1 answer

CheerioJS, looping through

I'm trying to loop through each
    and get the value of each
  • . The thing is, it only takes the first
12
votes
5 answers

Scrapy like tool for Nodejs?

I would like to know if there is something like Scrapy for nodejs ?. if not what do you think of using the simple page download and parsing it using cheerio ? is there a better way.
user2422940
  • 797
  • 2
  • 9
  • 21
11
votes
1 answer

Get the text of the current node only

In Cheerio, how do you get just the text of the current node only? var cheerio = require('cheerio') const htmlString = '
helloworld
' $ = cheerio.load(htmlString, { ignoreWhitespace: true }) console.log($('div').text()) …
Kevin
  • 2,671
  • 6
  • 31
  • 36
1
2 3
89 90