{"_id":"cheerio-advanced-selectors","_rev":"14-ed36dd039dc5bbe95005067faa23611c","name":"cheerio-advanced-selectors","description":"Add advanced selector support to cheerio","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"cheerio-advanced-selectors","version":"1.0.0","description":"Add advanced selector support to cheerio","main":"index.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"https://github.com/watson/cheerio-advanced-selectors.git"},"devDependencies":{"cheerio":"^0.19.0","standard":"^4.4.1","tape":"^4.0.0"},"keywords":["cheerio","jquery","query","queries","selector","selectors","find","last","first","eq"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/cheerio-advanced-selectors/issues"},"homepage":"https://github.com/watson/cheerio-advanced-selectors","coordinates":[18.4786101,-69.95490029999999],"gitHead":"5e3561bf6327f0e1e1163a808ed3e008fa03afeb","_id":"cheerio-advanced-selectors@1.0.0","_shasum":"edcb175ed504a72ccbd4a6c525b3c770659d5787","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"edcb175ed504a72ccbd4a6c525b3c770659d5787","tarball":"https://registry.npmjs.org/cheerio-advanced-selectors/-/cheerio-advanced-selectors-1.0.0.tgz","integrity":"sha512-a6g64vhBH0HxxLMHcV3UpqOC2Vthpq95qP5gSaxh2uOFlhQhQaWvCQAlQseF1vNlSRWajUQx8W7WoRMtMuX/0Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICXbeHUM+divk0+g7hZCv6UEEfJEUAkyGKywcW020KSYAiEAs/9VJ555EihV1eIJxSfibQeMETkb9WLfe1HObAfqwag="}]},"directories":{}},"1.0.1":{"name":"cheerio-advanced-selectors","version":"1.0.1","description":"Add advanced selector support to cheerio","main":"index.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"https://github.com/watson/cheerio-advanced-selectors.git"},"devDependencies":{"cheerio":"^0.19.0","standard":"^4.4.1","tape":"^4.0.0"},"keywords":["cheerio","css","jquery","query","queries","selector","selectors","find","last","first","eq","scraping","scraper","scrape"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/cheerio-advanced-selectors/issues"},"homepage":"https://github.com/watson/cheerio-advanced-selectors","coordinates":[18.4786101,-69.95490029999999],"gitHead":"8f700d70b8b4ef8df2d0d3ee7bc47545041593c3","_id":"cheerio-advanced-selectors@1.0.1","_shasum":"0416fa279b60ecbd99d13b665f993c35b28c5f87","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"0416fa279b60ecbd99d13b665f993c35b28c5f87","tarball":"https://registry.npmjs.org/cheerio-advanced-selectors/-/cheerio-advanced-selectors-1.0.1.tgz","integrity":"sha512-EehZtIBGr4/L1nWiBN5/BRqJ13N5YHc6doS68VwuxMcVO2dxyrvoU2ALNbO/EEMsynz+hbM2FlQBKB5igqWMOg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFQQAY5WN9qQZNY3DM/8GSF6/UPApNtsPf8euGNTDUuWAiB0Wy+ZZh7YV5ujc6vp9f34a6Zuqva+kAoBmpKGV01OVg=="}]},"directories":{}},"1.0.2":{"name":"cheerio-advanced-selectors","version":"1.0.2","description":"Add advanced selector support to cheerio","main":"index.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"https://github.com/watson/cheerio-advanced-selectors.git"},"devDependencies":{"cheerio":"^0.19.0","standard":"^4.4.1","tape":"^4.0.0"},"keywords":["cheerio","css","jquery","query","queries","selector","selectors","find","last","first","eq","scraping","scraper","scrape"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/cheerio-advanced-selectors/issues"},"homepage":"https://github.com/watson/cheerio-advanced-selectors","coordinates":[18.4786101,-69.95490029999999],"gitHead":"641b4cd5ce9ed8ee3e18e5b6fb05c1af85cfd199","_id":"cheerio-advanced-selectors@1.0.2","_shasum":"0bb3ff9481db93100b933de4f0c816de93a5f500","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"0bb3ff9481db93100b933de4f0c816de93a5f500","tarball":"https://registry.npmjs.org/cheerio-advanced-selectors/-/cheerio-advanced-selectors-1.0.2.tgz","integrity":"sha512-e3UyIt/ZKV/1s0L5OFXsKon/oGnKx71wOfKJofOnB0kA51k/BWjB5h0n/yCRHHac+2Mi1YsvZNy4N9fBokifsQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwsK4lxdK+DqJIAjU1PyJ114Qnc7Mo75gMP6GMNpPu0AIgDfALUlkIIFgDZol+ngPLx6EUJi7VlUMoHKHjcbxTKGQ="}]},"directories":{}},"1.1.0":{"name":"cheerio-advanced-selectors","version":"1.1.0","description":"Add advanced selector support to cheerio","main":"index.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"https://github.com/watson/cheerio-advanced-selectors.git"},"devDependencies":{"cheerio":"^0.19.0","standard":"^4.4.1","tape":"^4.0.0"},"keywords":["cheerio","css","jquery","query","queries","selector","selectors","find","last","first","eq","scraping","scraper","scrape"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/cheerio-advanced-selectors/issues"},"homepage":"https://github.com/watson/cheerio-advanced-selectors","coordinates":[18.4786101,-69.95490029999999],"gitHead":"ddcf2c0144f54c57e8ee541f761bdb0f1a4149d7","_id":"cheerio-advanced-selectors@1.1.0","_shasum":"4b26943ebbc76f2b26549f9ab6aee0d04c6d15ee","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"4b26943ebbc76f2b26549f9ab6aee0d04c6d15ee","tarball":"https://registry.npmjs.org/cheerio-advanced-selectors/-/cheerio-advanced-selectors-1.1.0.tgz","integrity":"sha512-6WyI6v39GBFXpkz0WJoUX7ls0ygxul1VQa186tFsqg+lhltBuA3RtoDS6KcJ4iosH15c/7z1VIHrZoU0NDuGGA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDUVPamazKQaPKwPpwSNO9wMvtwI7I3eDD8cIQhrLbn4gIgLMVFR+B6Q6wajLojeWbecw22A9l6qAa+lcWX3VIpUiA="}]},"directories":{}},"1.1.1":{"name":"cheerio-advanced-selectors","version":"1.1.1","description":"Add advanced selector support to cheerio","main":"index.js","scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/watson/cheerio-advanced-selectors.git"},"devDependencies":{"cheerio":"^0.19.0","standard":"^4.4.1","tape":"^4.0.0"},"keywords":["cheerio","css","jquery","query","queries","selector","selectors","find","last","first","eq","scraping","scraper","scrape"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/cheerio-advanced-selectors/issues"},"homepage":"https://github.com/watson/cheerio-advanced-selectors","coordinates":[55.6877308,12.595615],"gitHead":"0a22a888087446cc6c54262372cd800b4c81c76b","_id":"cheerio-advanced-selectors@1.1.1","_shasum":"3d7996a4ad91053943c71038eccf819b39509eb0","_from":".","_npmVersion":"2.15.5","_nodeVersion":"4.4.5","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"dist":{"shasum":"3d7996a4ad91053943c71038eccf819b39509eb0","tarball":"https://registry.npmjs.org/cheerio-advanced-selectors/-/cheerio-advanced-selectors-1.1.1.tgz","integrity":"sha512-B9+Sg4CLyIMQGEM/bg2SOcl64mBkqWEvpb7woCDva5OsUsoqVa4WkwsJnGeGWYfEDvkY+BrIF2IW63CxEYhSig==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCToZUn8P3aIXOKzeQI8Kk3+kG5fsV8awTT+QP6rtjYJwIgYae8E4MmjyP4AMtkMt0aUbz5G6DVrXUnwkfJ6SHPo6o="}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/cheerio-advanced-selectors-1.1.1.tgz_1467925836126_0.3832612514961511"},"directories":{}},"2.0.0":{"name":"cheerio-advanced-selectors","version":"2.0.0","description":"Add advanced selector support to cheerio","main":"index.js","scripts":{"test":"standard && ./node_modules/.bin/tav cheerio '>=0.18.0 || ^1.0.0-rc' -- node test.js"},"repository":{"type":"git","url":"git+https://github.com/watson/cheerio-advanced-selectors.git"},"devDependencies":{"cheerio":"^1.0.0-rc.2","standard":"^11.0.0","tape":"^4.9.0","test-all-versions":"^3.3.2"},"keywords":["cheerio","css","jquery","query","queries","selector","selectors","find","last","first","eq","scraping","scraper","scrape"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/cheerio-advanced-selectors/issues"},"homepage":"https://github.com/watson/cheerio-advanced-selectors","coordinates":[55.7776813,12.5814658],"gitHead":"9c06e27fc4fb8a12220b959ea7befd6eb2c5c780","_id":"cheerio-advanced-selectors@2.0.0","_npmVersion":"5.7.1","_nodeVersion":"9.6.1","_npmUser":{"name":"watson","email":"w@tson.dk"},"dist":{"integrity":"sha512-dkhutNjugtCsWnDlnMuIgEu09xV2o/g9m0WNZonuG4xoy2H7ow9AFTi37+Sl8DI5V7RBNbr4+wLJJwecF8h4ig==","shasum":"f3f362997146378e03fd93fad10a5fe031db1e10","tarball":"https://registry.npmjs.org/cheerio-advanced-selectors/-/cheerio-advanced-selectors-2.0.0.tgz","fileCount":6,"unpackedSize":13528,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGl0QjgInNz7YFe4FtysoBH4vfDrMhtmUTuySeDOeJ/HAiEAl6N0M36/gRJKJMYbu1+9tdvA3hSDXXJryC+izSLGcNg="}]},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cheerio-advanced-selectors_2.0.0_1520883761190_0.886934035236955"},"_hasShrinkwrap":false},"2.0.1":{"name":"cheerio-advanced-selectors","version":"2.0.1","description":"Add advanced selector support to cheerio","main":"index.js","scripts":{"test":"standard && ./node_modules/.bin/tav cheerio '>=0.18.0 || ^1.0.0-rc' -- node test.js"},"repository":{"type":"git","url":"git+https://github.com/watson/cheerio-advanced-selectors.git"},"devDependencies":{"cheerio":"^1.0.0-rc.2","standard":"^11.0.0","tape":"^4.9.0","test-all-versions":"^3.3.2"},"keywords":["cheerio","css","jquery","query","queries","selector","selectors","find","last","first","eq","scraping","scraper","scrape"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/cheerio-advanced-selectors/issues"},"homepage":"https://github.com/watson/cheerio-advanced-selectors","coordinates":[55.777579,12.589928],"gitHead":"841886af4841b4f4503ab91bf45a5cc2754e57ea","_id":"cheerio-advanced-selectors@2.0.1","_npmVersion":"5.7.1","_nodeVersion":"9.6.1","_npmUser":{"name":"watson","email":"w@tson.dk"},"dist":{"integrity":"sha512-5wHR8bpiD5pdUtaS81A6hnJezzoDzL1TLWfK6bxnLkIgEKPV26BlOdMCcvuj3fTE7JSalsTUeNU7AOD/u6bYhw==","shasum":"fb5ec70a4599e8cec1cf669c6d9b90a3fa969c48","tarball":"https://registry.npmjs.org/cheerio-advanced-selectors/-/cheerio-advanced-selectors-2.0.1.tgz","fileCount":6,"unpackedSize":13302,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD09PktJxViSVgHCP2zPMPV5JY1hXlOW9GAEX3SzN3P6QIgfwhhuADkUjKKxfjATIDW07UHvv0Pi9nK5L+fbY4A4Do="}]},"maintainers":[{"name":"watson","email":"w@tson.dk"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cheerio-advanced-selectors_2.0.1_1520883976843_0.09990456536946857"},"_hasShrinkwrap":false}},"readme":"# cheerio-advanced-selectors\n\nAdd support for the following selectors to\n[cheerio](https://github.com/cheeriojs/cheerio):\n\n- `:first`\n- `:last`\n- `:eq(index)`\n\nMore selectors can easily be added: Just [open an issue](https://github.com/watson/cheerio-advanced-selectors/issues) and I'll look into it :)\n\n[![Build status](https://travis-ci.org/watson/cheerio-advanced-selectors.svg?branch=master)](https://travis-ci.org/watson/cheerio-advanced-selectors)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)\n\nThis module is inspired by\n[cheerio-eq](https://github.com/watson/cheerio-eq) with the added\nsupport for many different selectors.\n\nSupports cheerio version 0.18.0 and above.\n\n## Installation\n\n```\nnpm install cheerio-advanced-selectors\n```\n\n## Usage\n\nUse the `.wrap()` function to make cheerio-advanced-selectors take care\nof everything for you:\n\n```js\nvar cheerio = require('cheerio')\nvar cheerioAdv = require('cheerio-advanced-selectors')\n\ncheerio = cheerioAdv.wrap(cheerio)\n\nvar $ = cheerio.load('<div>foo</div><div>bar</div>')\n\n$('div:first').text() // => 'foo'\n```\n\n## Advanced usage\n\nAlternatively use the `.find()` function to only use\ncheerio-advanced-selectors for a specific selector:\n\n```js\nvar cheerio = require('cheerio')\nvar cheerioAdv = require('cheerio-advanced-selectors')\n\nvar $ = cheerio.load('<div><span>foo</span></div><div><span>bar</span></div>')\n\ncheerioAdv.find($, 'div:eq(1)').text() // => 'bar'\n```\n\nIf you need to run the same selector on a lot of different HTML\ndocuments, you can speed things up by pre-compiling the selector using\nthe `.compile()` function:\n\n```js\nvar cheerio = require('cheerio')\nvar cheerioAdv = require('cheerio-advanced-selectors')\n\nvar myH1 = cheerioAdv.compile('div:first span:eq(1) h1')\n\nvar html1 = cheerio.load('<div><span><h1>foo1</h1></span><span><h1>bar1</h1></span></div>')\nvar html2 = cheerio.load('<div><span><h1>foo2</h1></span><span><h1>bar2</h1></span></div>')\n\nmyH1(html1).text() // => 'bar1'\nmyH1(html2).text() // => 'bar2'\n```\n\n## What's the problem?\n\nCheerio sacrifices advanced CSS selector support for speed. This means\nfor instance that the `:eq()` selector isn't supported. The work-around\nis normally to use the `.eq()` function instead:\n\n```js\n// this will not work:\n$('div:eq(1)');\n\n// use this instead:\n$('div').eq(1);\n```\n\nThis is a good alternative if you write the CSS selectors from scrach,\nbut what if you are working with selectors that already contain `:eq()`?\n**Don't fear, cheerio-advanced-selectors is here :)**\n\n### Solution\n\nThe solution to the problem is to automatically parse the selector\nstring at run-time. So if you give cheerio-advanced-selectors a selector\nlike `div:eq(1)` it will return the following cheerio cursor:\n`$('div').eq(1)`.\n\nIt also works for complex selectors, so that `div:eq(1) h2:first span`\nwill be converted and interpreted as\n`$('div').eq(1).find('h2').first().find('span')`.\n\n## Supported advanced selectors\n\nThis module currently only support a minimal subset of the possible\nadvanced selectors:\n\n- `:first`\n- `:last`\n- `:eq(index)`\n\nBut don't fear :) It's easy to add support for other selectors. Just\n[open an\nissue](https://github.com/watson/cheerio-advanced-selectors/issues) or\nmake a pull request.\n\n## API\n\n#### `.wrap(cheerio)`\n\nWraps the main cheerio module to overload the standard `load` function\nso it knows how to handle the advanced selectors.\n\nReturns the `cheerio` module.\n\n#### `.find(cheerio, selector [, context [, root]])`\n\nRun the `selector` on the given cheerio object optionally within the\ngiven `context` and optionally on the given `root`.\n\nThe `cheerio` object is usually called `$`.\n\n#### `.compile(selector)`\n\nCompiles the `selector` and returns a function which take 3 arguments:\n`fn(cheerio [, context [, root]])`:\n\n- `cheerio` - a reference to the cheerio object (usually called `$`)\n- `context` - the context in which to run the selector (optional)\n- `root` - the HTML root on which to run the selector (optional)\n\n## License\n\nMIT\n","maintainers":[{"name":"watson","email":"w@tson.dk"}],"time":{"modified":"2022-06-13T05:56:26.899Z","created":"2015-06-29T22:26:07.205Z","1.0.0":"2015-06-29T22:26:07.205Z","1.0.1":"2015-06-30T04:44:40.886Z","1.0.2":"2015-06-30T14:54:09.328Z","1.1.0":"2015-06-30T16:36:09.520Z","1.1.1":"2016-07-07T21:10:37.294Z","2.0.0":"2018-03-12T19:42:41.239Z","2.0.1":"2018-03-12T19:46:17.019Z"},"homepage":"https://github.com/watson/cheerio-advanced-selectors","keywords":["cheerio","css","jquery","query","queries","selector","selectors","find","last","first","eq","scraping","scraper","scrape"],"repository":{"type":"git","url":"git+https://github.com/watson/cheerio-advanced-selectors.git"},"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"bugs":{"url":"https://github.com/watson/cheerio-advanced-selectors/issues"},"license":"MIT","readmeFilename":"README.md","users":{"matiasmarani":true,"hengkiardo":true,"jaggedsoft":true,"godber":true}}