@8ms/helpers 1.27.0 → 1.28.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.
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
* https://developers.google.com/google-ads/api/data/geotargets
|
|
9
9
|
*/
|
|
10
10
|
const buildGoogleSerpUrl = (props) => {
|
|
11
|
-
let url = new URL(`https://www.${props.googleDomain}
|
|
11
|
+
let url = new URL(`https://www.${props.googleDomain}/search`);
|
|
12
12
|
url.searchParams.append("q", props.query);
|
|
13
13
|
// Two-letter country code used to define the country of search
|
|
14
14
|
if (props?.country) {
|
|
@@ -73,8 +73,13 @@ const buildGoogleSerpUrl = (props) => {
|
|
|
73
73
|
url.searchParams.append("num", props.pagination.perPage.toString());
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
//
|
|
77
|
-
|
|
76
|
+
// Specify the output type
|
|
77
|
+
if ("json" === props.output) {
|
|
78
|
+
url.searchParams.append("brn_json", "1");
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
url.searchParams.append("brn_json", "html");
|
|
82
|
+
}
|
|
78
83
|
return url.toString();
|
|
79
84
|
};
|
|
80
85
|
exports.default = buildGoogleSerpUrl;
|