semrush-api-client 0.1.5 → 0.1.7
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.
- package/dist/client/index.d.ts +8 -2
- package/dist/client/index.js +9 -3
- package/dist/domain/getAdsCopies.d.ts +11 -0
- package/dist/domain/getAdsCopies.js +13 -0
- package/dist/domain/getDomainOrganic.d.ts +15 -0
- package/dist/domain/getDomainOrganic.js +28 -0
- package/dist/domain/getDomainPaidSearchKeywords.d.ts +13 -0
- package/dist/domain/getDomainPaidSearchKeywords.js +27 -0
- package/dist/{domain/getDomainRank.d.ts → overview/getDomainOverview.d.ts} +1 -1
- package/dist/{domain/getDomainRank.js → overview/getDomainOverview.js} +2 -2
- package/package.json +5 -2
package/dist/client/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getDomainOverview } from "../overview/getDomainOverview";
|
|
2
2
|
import { getPhraseAll } from "../keyword/getPhrase";
|
|
3
3
|
import { backlinksOverview } from "../backlinks/backlinksOverview";
|
|
4
4
|
import { getRankDifference } from "../overview/getRankDifference";
|
|
5
|
+
import { getDomainOrganic } from "../domain/getDomainOrganic";
|
|
6
|
+
import { getDomainPaidSearchKeywords } from "../domain/getDomainPaidSearchKeywords";
|
|
7
|
+
import { getAdsCopies } from "../domain/getAdsCopies";
|
|
5
8
|
import { getSemrushRank } from "../overview/getSemrushRank";
|
|
6
9
|
export declare class SemrushAPIClient {
|
|
7
10
|
private client;
|
|
@@ -13,9 +16,12 @@ export declare class SemrushAPIClient {
|
|
|
13
16
|
});
|
|
14
17
|
parseCsvToObjects(csvString: string, delimiter?: string): Record<string, string>[];
|
|
15
18
|
get<T>(url: string, params?: Record<string, any>, outputObj?: boolean): Promise<T>;
|
|
16
|
-
|
|
19
|
+
getDomainOverview: typeof getDomainOverview;
|
|
17
20
|
getPhrase: typeof getPhraseAll;
|
|
18
21
|
backlinksOverview: typeof backlinksOverview;
|
|
19
22
|
getRankDifference: typeof getRankDifference;
|
|
20
23
|
getSemrushRank: typeof getSemrushRank;
|
|
24
|
+
getDomainOrganic: typeof getDomainOrganic;
|
|
25
|
+
getDomainPaidSearchKeywords: typeof getDomainPaidSearchKeywords;
|
|
26
|
+
getAdsCopies: typeof getAdsCopies;
|
|
21
27
|
}
|
package/dist/client/index.js
CHANGED
|
@@ -5,10 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SemrushAPIClient = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const
|
|
8
|
+
const getDomainOverview_1 = require("../overview/getDomainOverview");
|
|
9
9
|
const getPhrase_1 = require("../keyword/getPhrase");
|
|
10
10
|
const backlinksOverview_1 = require("../backlinks/backlinksOverview");
|
|
11
11
|
const getRankDifference_1 = require("../overview/getRankDifference");
|
|
12
|
+
const getDomainOrganic_1 = require("../domain/getDomainOrganic");
|
|
13
|
+
const getDomainPaidSearchKeywords_1 = require("../domain/getDomainPaidSearchKeywords");
|
|
14
|
+
const getAdsCopies_1 = require("../domain/getAdsCopies");
|
|
12
15
|
const getSemrushRank_1 = require("../overview/getSemrushRank");
|
|
13
16
|
class SemrushAPIClient {
|
|
14
17
|
client;
|
|
@@ -18,7 +21,7 @@ class SemrushAPIClient {
|
|
|
18
21
|
constructor({ api_key }) {
|
|
19
22
|
this.api_key = api_key;
|
|
20
23
|
this.client = axios_1.default.create({
|
|
21
|
-
timeout:
|
|
24
|
+
timeout: 14000,
|
|
22
25
|
});
|
|
23
26
|
}
|
|
24
27
|
parseCsvToObjects(csvString, delimiter = ";") {
|
|
@@ -55,10 +58,13 @@ class SemrushAPIClient {
|
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
|
-
|
|
61
|
+
getDomainOverview = getDomainOverview_1.getDomainOverview;
|
|
59
62
|
getPhrase = getPhrase_1.getPhraseAll;
|
|
60
63
|
backlinksOverview = backlinksOverview_1.backlinksOverview;
|
|
61
64
|
getRankDifference = getRankDifference_1.getRankDifference;
|
|
62
65
|
getSemrushRank = getSemrushRank_1.getSemrushRank;
|
|
66
|
+
getDomainOrganic = getDomainOrganic_1.getDomainOrganic;
|
|
67
|
+
getDomainPaidSearchKeywords = getDomainPaidSearchKeywords_1.getDomainPaidSearchKeywords;
|
|
68
|
+
getAdsCopies = getAdsCopies_1.getAdsCopies;
|
|
63
69
|
}
|
|
64
70
|
exports.SemrushAPIClient = SemrushAPIClient;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SemrushAPIClient } from "../client";
|
|
2
|
+
import { Database } from "../type/general/database";
|
|
3
|
+
type ExportColumns = "Tt" | "Ds" | "Vu" | "Ur" | "Pc" | "Un";
|
|
4
|
+
export declare function getAdsCopies(this: SemrushAPIClient, { domain, export_columns, database, display_limit, outputObj, }: {
|
|
5
|
+
domain: string;
|
|
6
|
+
export_columns?: ExportColumns[];
|
|
7
|
+
database?: Database;
|
|
8
|
+
outputObj?: boolean;
|
|
9
|
+
display_limit?: number;
|
|
10
|
+
}): Promise<string>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAdsCopies = getAdsCopies;
|
|
4
|
+
async function getAdsCopies({ domain, export_columns = ["Tt", "Ds", "Vu", "Ur", "Pc", "Un"], database = "us", display_limit = 1000, outputObj = true, }) {
|
|
5
|
+
const params = {
|
|
6
|
+
type: "domain_adwords_unique",
|
|
7
|
+
export_columns: export_columns.join(","),
|
|
8
|
+
domain,
|
|
9
|
+
database,
|
|
10
|
+
display_limit,
|
|
11
|
+
};
|
|
12
|
+
return this.get(this.BASE_URL, params, outputObj);
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SemrushAPIClient } from "../client";
|
|
2
|
+
import { Database } from "../type/general/database";
|
|
3
|
+
type ExportColumns = "Ph" | "Po" | "Pp" | "Pd" | "Nq" | "Cp" | "Ur" | "Tr" | "Tg" | "Tc" | "Co" | "Nr" | "Td" | "Kd" | "Fp" | "Fk" | "Ts" | "In" | "Pt";
|
|
4
|
+
type displayPositions = "new" | "lost" | "rise" | "fall";
|
|
5
|
+
type displayPositionType = "organic" | "all" | "serp_features";
|
|
6
|
+
export declare function getDomainOrganic(this: SemrushAPIClient, { domain, export_columns, database, displayPosition, displayPositionsType, display_limit, outputObj, }: {
|
|
7
|
+
domain: string;
|
|
8
|
+
export_columns?: ExportColumns[];
|
|
9
|
+
displayPosition?: displayPositions;
|
|
10
|
+
database?: Database;
|
|
11
|
+
outputObj?: boolean;
|
|
12
|
+
displayPositionsType?: displayPositionType;
|
|
13
|
+
display_limit?: number;
|
|
14
|
+
}): Promise<string>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDomainOrganic = getDomainOrganic;
|
|
4
|
+
async function getDomainOrganic({ domain, export_columns = [
|
|
5
|
+
"Ph",
|
|
6
|
+
"Po",
|
|
7
|
+
"Pp",
|
|
8
|
+
"Pd",
|
|
9
|
+
"Nq",
|
|
10
|
+
"Cp",
|
|
11
|
+
"Ur",
|
|
12
|
+
"Tr",
|
|
13
|
+
"Tc",
|
|
14
|
+
"Co",
|
|
15
|
+
"Nr",
|
|
16
|
+
"Td",
|
|
17
|
+
], database = "us", displayPosition, displayPositionsType, display_limit = 1000, outputObj = true, }) {
|
|
18
|
+
const params = {
|
|
19
|
+
type: "domain_organic",
|
|
20
|
+
export_columns: export_columns.join(","),
|
|
21
|
+
domain,
|
|
22
|
+
database,
|
|
23
|
+
display_position: displayPosition,
|
|
24
|
+
display_positions_type: displayPositionsType,
|
|
25
|
+
display_limit,
|
|
26
|
+
};
|
|
27
|
+
return this.get(this.BASE_URL, params, outputObj);
|
|
28
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SemrushAPIClient } from "../client";
|
|
2
|
+
import { Database } from "../type/general/database";
|
|
3
|
+
type ExportColumns = "Ph" | "Po" | "Pp" | "Pd" | "Ab" | "Nq" | "Cp" | "Ur" | "Tr" | "Tg" | "Tc" | "Co" | "Nr" | "Td" | "Tt" | "Ds" | "Vu" | "Ur" | "Ts" | "Un";
|
|
4
|
+
type displayPositions = "new" | "lost" | "rise" | "fall";
|
|
5
|
+
export declare function getDomainPaidSearchKeywords(this: SemrushAPIClient, { domain, export_columns, database, displayPosition, display_limit, outputObj, }: {
|
|
6
|
+
domain: string;
|
|
7
|
+
export_columns?: ExportColumns[];
|
|
8
|
+
displayPosition?: displayPositions;
|
|
9
|
+
database?: Database;
|
|
10
|
+
outputObj?: boolean;
|
|
11
|
+
display_limit?: number;
|
|
12
|
+
}): Promise<string>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDomainPaidSearchKeywords = getDomainPaidSearchKeywords;
|
|
4
|
+
async function getDomainPaidSearchKeywords({ domain, export_columns = [
|
|
5
|
+
"Ph",
|
|
6
|
+
"Po",
|
|
7
|
+
"Pp",
|
|
8
|
+
"Pd",
|
|
9
|
+
"Nq",
|
|
10
|
+
"Cp",
|
|
11
|
+
"Vu",
|
|
12
|
+
"Tr",
|
|
13
|
+
"Tc",
|
|
14
|
+
"Co",
|
|
15
|
+
"Nr",
|
|
16
|
+
"Td",
|
|
17
|
+
], database = "us", displayPosition, display_limit = 1000, outputObj = true, }) {
|
|
18
|
+
const params = {
|
|
19
|
+
type: "domain_adwords",
|
|
20
|
+
export_columns: export_columns.join(","),
|
|
21
|
+
domain,
|
|
22
|
+
database,
|
|
23
|
+
display_position: displayPosition,
|
|
24
|
+
display_limit,
|
|
25
|
+
};
|
|
26
|
+
return this.get(this.BASE_URL, params, outputObj);
|
|
27
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SemrushAPIClient } from "../client";
|
|
2
2
|
import { Database } from "../type/general/database";
|
|
3
3
|
import { ExportColumns } from "../type/general/exportColumns";
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function getDomainOverview(this: SemrushAPIClient, { domain, export_columns, database, display_limit, outputObj, }: {
|
|
5
5
|
domain: string;
|
|
6
6
|
export_columns?: ExportColumns[];
|
|
7
7
|
database?: Database;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
async function
|
|
3
|
+
exports.getDomainOverview = getDomainOverview;
|
|
4
|
+
async function getDomainOverview({ domain, export_columns = ["Dn", "Or", "Rk", "Ot", "Oc"], database = "us", display_limit = 1000, outputObj = true, // Default to true for output object
|
|
5
5
|
}) {
|
|
6
6
|
const params = {
|
|
7
7
|
type: "domain_ranks",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semrush-api-client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,7 +18,10 @@
|
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": "20"
|
|
20
20
|
},
|
|
21
|
-
"keywords": [
|
|
21
|
+
"keywords": [
|
|
22
|
+
"semrush",
|
|
23
|
+
"api"
|
|
24
|
+
],
|
|
22
25
|
"author": "",
|
|
23
26
|
"type": "commonjs",
|
|
24
27
|
"dependencies": {
|