Comparing version 4.1.2 to 5.0.0
@@ -21,3 +21,9 @@ "use strict"; | ||
* @param {Function} cb The callback function. | ||
* @return {Promise} A promise object. | ||
* @return {Promise} A promise object resolving with: | ||
* | ||
* - `data` (Object): The scraped data. | ||
* - `$` (Function): The Cheeerio function. This may be handy to do some other manipulation on the DOM, if needed. | ||
* - `response` (Object): The response object. | ||
* - `body` (String): The raw body as a string. | ||
* | ||
*/ | ||
@@ -32,3 +38,8 @@ function scrapeIt(url, opts, cb) { | ||
var scrapedData = scrapeIt.scrapeHTML($, opts); | ||
cb(null, scrapedData, $, res, body); | ||
cb(null, { | ||
data: scrapedData, | ||
$: $, | ||
response: res, | ||
body: body | ||
}); | ||
} catch (err) { | ||
@@ -35,0 +46,0 @@ cb(err); |
@@ -14,3 +14,3 @@ { | ||
"license": "MIT", | ||
"version": "4.1.2", | ||
"version": "5.0.0", | ||
"main": "lib/index.js", | ||
@@ -17,0 +17,0 @@ "types": "lib/index.d.ts", |
@@ -38,4 +38,5 @@ <!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. --> | ||
} | ||
}).then(page => { | ||
console.log(page) | ||
}).then(({ data, response }) => { | ||
console.log(`Status Code: ${response.statusCode}`) | ||
console.log(data) | ||
}) | ||
@@ -92,4 +93,4 @@ | ||
} | ||
}, (err, page) => { | ||
console.log(err || page) | ||
}, (err, { data }) => { | ||
console.log(err || data) | ||
}) | ||
@@ -146,3 +147,7 @@ // { articles: | ||
#### Return | ||
- **Promise** A promise object. | ||
- **Promise** A promise object resolving with: | ||
- `data` (Object): The scraped data. | ||
- `$` (Function): The Cheeerio function. This may be handy to do some other manipulation on the DOM, if needed. | ||
- `response` (Object): The response object. | ||
- `body` (String): The raw body as a string. | ||
@@ -237,2 +242,3 @@ ### `scrapeIt.scrapeHTML($, opts)` | ||
- Starring and sharing the projects you like :rocket: | ||
@@ -246,2 +252,3 @@ - [![Buy me a book][badge_amazon]][amazon]—I love books! I will remember you after years if you buy me one. :grin: :book: | ||
Thanks! :heart: | ||
@@ -264,5 +271,7 @@ | ||
- [`do-fn`](https://github.com/selfrefactor/do-fn#readme) (by selfrefactor)—common functions used by I Learn Smarter project | ||
- [`egg-crawler`](https://github.com/aa900031/egg-crawler#readme) (by zhong666)—[![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][codecov-image]][codecov-url] [![David deps][david-image]][david-url] [![Known Vulnerabilities][snyk-image]][snyk-url] [![npm download][download-image]][down | ||
- [`jishon`](https://github.com/chee/jishon#readme) (by chee)—take a search term and get json from jisho | ||
- [`mit-ocw-scraper`](https://npmjs.com/package/mit-ocw-scraper)—MIT-OCW-Scraper | ||
- [`mix-dl`](https://github.com/luandro/mix-dl#readme) (by Luandro)—Download youtube mix for list of artists using youtube-dl. | ||
- [`paklek-cli`](https://npmjs.com/package/paklek-cli) (by ade yahya)—ade's personal cli | ||
- [`parn`](https://github.com/dsslimshaddy/parn#readme) (by Slim Shady)—It installs hex packages in the elixir app from http://hex.pm. | ||
@@ -287,10 +296,11 @@ - [`picarto-lib`](https://github.com/SpacemannFinn/Picarto-Lib#readme) (by Sochima Nwobia)—Basic Library to make interfacing with picarto easier | ||
[badge_patreon]: http://ionicabizau.github.io/badges/patreon.svg | ||
[badge_amazon]: http://ionicabizau.github.io/badges/amazon.svg | ||
[badge_paypal]: http://ionicabizau.github.io/badges/paypal.svg | ||
[badge_paypal_donate]: http://ionicabizau.github.io/badges/paypal_donate.svg | ||
[badge_patreon]: https://ionicabizau.github.io/badges/patreon.svg | ||
[badge_amazon]: https://ionicabizau.github.io/badges/amazon.svg | ||
[badge_paypal]: https://ionicabizau.github.io/badges/paypal.svg | ||
[badge_paypal_donate]: https://ionicabizau.github.io/badges/paypal_donate.svg | ||
[patreon]: https://www.patreon.com/ionicabizau | ||
[amazon]: http://amzn.eu/hRo9sIZ | ||
[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW | ||
[donate-now]: http://i.imgur.com/6cMbHOC.png | ||
@@ -297,0 +307,0 @@ [license]: http://showalicense.com/?fullname=Ionic%C4%83%20Biz%C4%83u%20%3Cbizauionica%40gmail.com%3E%20(https%3A%2F%2Fionicabizau.net)&year=2016#license-mit |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24009
237
304