FAQ Database Discussion Community


Finding alternate selectors from contains

jquery,cheerio
I have a list of elements obtained through the contains selector. Let's say I want to know how to access a person's name on a profile page. I can test my own profile with my own name. let name = $(':contains(jamie)'); I'd like to store a selector based on the...

Javascript function not returning updated object

javascript,json,web-scraping,cheerio
I wrote this function and when I run it, it returns {}. When I log json in the the function passed to $('.price').filter, it shows the json object has been updated with the correct data. However, at the end of my function it returns an empty object. I don't understand...

How to select XML element based on tag name using Jquery selectors?

jquery,node.js,cheerio
If I have an XML document and I am parsing it using Jquery selectors (using the CheerioJS module), how can I grab the value of the value, task, and data tag of the first item without basing it on child position, ie basing it on the actual name of the...

Append a node's siblings using Cheerio?

javascript,dom,cheerio
I have a div containing an h3 and some divs. I want to essentially wrap all of the divs together in one container div, but Cheerio doesn't have a wrap or wrap-together function. Right now I'm appending the container div, making it a sibling of the divs that need to...

How to remove
and
using Cheerio js?

javascript,node.js,cheerio
I have the following html that I like to parse through Cheerios. var $ = cheerio.load('<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>This works well.</div><div><br clear="none"/></div><div>So I have been doing this for several hours. How come the space does not split? Thinking that this could be an...

Express and Cheerio/JSDOM

javascript,node.js,dom,express,cheerio
I am trying to get Cheerio to work with Express. I'd like to be able to manipulate the dom from the server, but all I have found is web scraping.. There are some requirements.. At the moment, I am able to run multiple app.listen(port); statements, and use multiple servers. I'm...

Selecting content within the current $(this) selector jquery

javascript,jquery,html,node.js,cheerio
You can take a look at my jsfiddle for an example of what I am trying to do. Here is the Javascript code in question: $("#div_games table tr").each(function(index) { var num = index; console.log($(this).text()); }); And the table is from Hockey-reference.com. I want to organize each row (tr) into a...

Cheerio: need to pass around $ along with elements?

javascript,node.js,function,cheerio
I have several utitity functions, that operate on cheerio objects. To nearly every one of these functions I have to pass $ along with the element itsself. Example: function aUtilityFunc($, cheerioEl) { // <- $ in the params return cheerioEl.each(function (i, child) { // i do not want to do...

Handle on success event with npm package request

javascript,node.js,request,cheerio
I have a node.js app that scrapes informations from a website. I'm using npm packages request and cheerio and the scraping works fine but I want to do something else when the request function is done. Here's some code: app.js var express = require('express'); var extractor = require("./extractor"); console.log(extractor('http://www.example.com'));...

How can I scrape pages with dynamic content using node.js?

node.js,request,web-crawler,phantomjs,cheerio
I am trying to scrape a website but I don't get some of the elements, because these elements are dynamically created. I use the cheerio in node.js and My code is below. var request = require('request'); var cheerio = require('cheerio'); var url = "http://www.bdtong.co.kr/index.php?c_category=C02"; request(url, function (err, res, html) {...