New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

aimer

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aimer - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

26

index.js
'use strict'
const cheerio = require('cheerio')
const got = require('got')
const HttpsProxyAgent = require('https-proxy-agent')
const fetch = require('node-fetch')

@@ -12,6 +11,2 @@ module.exports = function (url, opts) {

opts = opts || {}
const proxy = opts.proxy === undefined ?
process.env.http_proxy :
opts.proxy
const cheerioOpts = Object.assign({

@@ -21,13 +16,10 @@ // keep the original unicode chars

}, opts.cheerio)
const gotOptions = Object.assign({
agent: proxy && (new HttpsProxyAgent(proxy))
}, opts.got)
const ret = got.get(url, gotOptions).then(data => {
if (data.statusCode !== 200) {
return Promise.reject(new Error(data.statusText))
}
return data.body
})
// normal mode, faster
const ret = fetch(url)
.then(data => {
if (data.status !== 200) {
return Promise.reject(new Error(data.statusText))
}
return data.text()
})
if (opts.htmlOnly) {

@@ -34,0 +26,0 @@ return ret

{
"name": "aimer",
"version": "1.2.0",
"version": "1.3.0",
"description": "Remote web content crawler done right.",

@@ -27,8 +27,6 @@ "license": "MIT",

"cheerio": "^0.20.0",
"got": "^6.3.0",
"https-proxy-agent": "^1.0.0"
"node-fetch": "^1.5.1"
},
"devDependencies": {
"ava": "^0.14.0",
"is-ci": "^1.0.9",
"xo": "^0.15.0"

@@ -35,0 +33,0 @@ },

@@ -41,12 +41,4 @@ # aimer [![NPM version](https://img.shields.io/npm/v/aimer.svg)](https://npmjs.com/package/aimer) [![NPM downloads](https://img.shields.io/npm/dm/aimer.svg)](https://npmjs.com/package/aimer) [![Circle CI](https://circleci.com/gh/egoist/aimer/tree/master.svg?style=svg)](https://circleci.com/gh/egoist/aimer/tree/master)

##### got
[got](https://github.com/sindresorhus/got) options, this module is used for retriving web contents.
##### proxy
An http or https proxy address, eg: `http://localhost:8787` for Lantern. If `process.env.http_proxy` is set and `opts.proxy` is not set we use the former. Set `opts.proxy` to `false` to disable proxy anyway.
## License
MIT © [EGOIST](https://github.com/egoist)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc