Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
cheerio-soupselect
Advanced tools
Adds CSS selector support to htmlparser for scraping activities - port of soupselect (python)
A fork of harryf's [node-soupselect] (http://github.com/harryf/node-soupselect), which is originally a port of Simon Willison's soupselect for use with node.js and node-htmlparser.
$ npm install cheerio-soupselect
From the root folder:
$ make test
cheerio-soupselect supports all of the most common jQuery selectors, including multiple attribute selectors and multiple selectors.
soupselect also supports a bunch of basic filters, listed below. Each filter is implement according to the jQuery specification.
cheerio-soupselect supports custom filters through the
exported filters
object. It's simple:
var soupselect = require("cheerio-soupselect"),
filters = soupselect.filters;
...
filters["custom-filter"] = function(ctx, val){
console.log("Hello filters!");
return [];
};
...
var ret = soupselect.select(dom, ":custom-filter('awesome arg')");
The ctx
parameter provides an array of htmlparser2
DOMs, which are themselves arrays. These element are
grouped by parent.
The val
parameter provides access to everything inside
the brackets of the filter, if anything.
A few notes about custom selectors:
Your custom function must return an array.
For the most part, you will not need to handle
nesting filters/selectors. However, if you wish
to modify the nested selector then, you may do
so by modifiying val
.
FAQs
Adds CSS selector support to htmlparser for scraping activities - port of soupselect (python)
The npm package cheerio-soupselect receives a total of 342 weekly downloads. As such, cheerio-soupselect popularity was classified as not popular.
We found that cheerio-soupselect demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.