@8ms/helpers 1.25.0 → 1.26.0

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.
@@ -22,5 +22,5 @@ type BuildGoogleSerpUrl = {
22
22
  * For geolocation use value from:
23
23
  * https://developers.google.com/google-ads/api/data/geotargets
24
24
  */
25
- declare const buildGoogleSerpUrl: (props: BuildGoogleSerpUrl) => URL;
25
+ declare const buildGoogleSerpUrl: (props: BuildGoogleSerpUrl) => string;
26
26
  export default buildGoogleSerpUrl;
@@ -75,6 +75,6 @@ const buildGoogleSerpUrl = (props) => {
75
75
  }
76
76
  // Always return the JSON response with HTML field
77
77
  url.searchParams.append("brn_json", "html");
78
- return url;
78
+ return url.toString();
79
79
  };
80
80
  exports.default = buildGoogleSerpUrl;
@@ -13,5 +13,5 @@ type BuildGoogleTrendsUrl = {
13
13
  * For category use value from:
14
14
  * https://trends.google.com/trends/api/explore/pickers/category?lang=en-US&tz=240
15
15
  */
16
- declare const buildGoogleTrendsUrl: (props: BuildGoogleTrendsUrl) => URL;
16
+ declare const buildGoogleTrendsUrl: (props: BuildGoogleTrendsUrl) => string;
17
17
  export default buildGoogleTrendsUrl;
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
8
8
  * https://trends.google.com/trends/api/explore/pickers/category?lang=en-US&tz=240
9
9
  */
10
10
  const buildGoogleTrendsUrl = (props) => {
11
- let url = new URL(`https://trends.google.com/`);
11
+ let url = new URL(`http://trends.google.com/trends/explore`);
12
12
  url.searchParams.append("q", props.query);
13
13
  // Location of interest, two-letter country code
14
14
  if (props?.country) {
@@ -39,6 +39,6 @@ const buildGoogleTrendsUrl = (props) => {
39
39
  url.searchParams.append("gprop", "youtube");
40
40
  break;
41
41
  }
42
- return url;
42
+ return url.toString();
43
43
  };
44
44
  exports.default = buildGoogleTrendsUrl;
@@ -1,7 +1,10 @@
1
1
  type GetRealtime = {
2
- customerId: string;
3
- host: string;
4
- zonePassword: string;
2
+ auth: {
3
+ host: string;
4
+ port: string;
5
+ username: string;
6
+ password: string;
7
+ };
5
8
  url: string;
6
9
  };
7
10
  /**
@@ -9,19 +9,21 @@ const get_1 = __importDefault(require("../../axios/get"));
9
9
  */
10
10
  const getRealtime = async (props) => {
11
11
  let response = {};
12
- const { HttpsProxyAgent } = require("https-proxy-agent");
13
12
  // Prevent auth requests getting blocked
14
13
  process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
15
- // Construct the proxy URL
16
- const proxyUrl = `http://${props.customerId}:${props.zonePassword}@${props.host}`;
17
- // Replace <proxy_url> with your actual proxy URL
18
- const httpsAgent = new HttpsProxyAgent(proxyUrl);
19
14
  // Use fetch with the agent option to make an HTTP request through the proxy
20
15
  // Replace <target_url> with the URL you want to request
21
16
  const apiResponse = await (0, get_1.default)({
22
17
  config: {
23
- proxy: false,
24
- httpsAgent,
18
+ proxy: {
19
+ protocol: "http",
20
+ host: props.auth.host,
21
+ port: props.auth.port,
22
+ auth: {
23
+ username: props.auth.username,
24
+ password: props.auth.password,
25
+ }
26
+ },
25
27
  },
26
28
  url: props.url,
27
29
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "1.25.0",
4
+ "version": "1.26.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
@@ -39,7 +39,6 @@
39
39
  "@types/lodash": "4.17.7",
40
40
  "@types/node": "20.14.12",
41
41
  "babel-jest": "29.7.0",
42
- "https-proxy-agent": "7.0.5",
43
42
  "jest": "29.7.0",
44
43
  "node-fetch": "3.3.2",
45
44
  "stream-chain": "2.2.5",