unprint 0.14.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/app.js +9 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unprint",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "Simplify common web scraping tasks while staying in control of the data.",
5
5
  "main": "src/app.js",
6
6
  "scripts": {
@@ -28,9 +28,9 @@
28
28
  "eslint": "^8.17.0",
29
29
  "eslint-config-airbnb": "^19.0.4",
30
30
  "eslint-config-airbnb-base": "^15.0.0",
31
- "https-proxy-agent": "^7.0.5",
32
31
  "jsdom": "^17.0.0",
33
- "moment-timezone": "^0.5.34"
32
+ "moment-timezone": "^0.5.34",
33
+ "tunnel": "^0.0.6"
34
34
  },
35
35
  "devDependencies": {
36
36
  "express": "^4.18.1"
package/src/app.js CHANGED
@@ -4,8 +4,8 @@ const { JSDOM, VirtualConsole } = require('jsdom');
4
4
  const EventEmitter = require('events');
5
5
  const http = require('http');
6
6
  const https = require('https');
7
+ const tunnel = require('tunnel');
7
8
  const axios = require('axios').default;
8
- const { HttpsProxyAgent } = require('https-proxy-agent');
9
9
  const Bottleneck = require('bottleneck');
10
10
  const moment = require('moment-timezone');
11
11
  const merge = require('deepmerge');
@@ -960,14 +960,15 @@ async function request(url, body, customOptions = {}, method = 'GET') {
960
960
  });
961
961
 
962
962
  if (options.proxy) {
963
- // instance.defaults.httpAgent = new HttpsProxyAgent(`http://${options.proxy.host}:${options.proxy.port}`, { ...options.agent });
964
- instance.defaults.httpsAgent = options.httpsAgent || new HttpsProxyAgent(`http://${options.proxy.host}:${options.proxy.port}`, { ...options.agent });
963
+ const proxyAgent = tunnel.httpsOverHttp({
964
+ proxy: {
965
+ host: options.proxy.host,
966
+ port: options.proxy.port,
967
+ },
968
+ });
965
969
 
966
- instance.defaults.proxy = {
967
- protocol: 'http',
968
- host: options.proxy.host,
969
- port: options.proxy.port,
970
- };
970
+ instance.defaults.httpAgent = proxyAgent;
971
+ instance.defaults.httpsAgent = proxyAgent;
971
972
  } else {
972
973
  instance.defaults.httpAgent = options.httpsAgent || new http.Agent({ ...options.agent });
973
974
  instance.defaults.httpsAgent = options.httpsAgent || new https.Agent({ ...options.agent });