builtwith-api 1.0.6 → 3.1.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.
- package/LICENSE +21 -0
- package/README.md +184 -24
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +742 -0
- package/dist/cli.js.map +17 -0
- package/dist/commands.d.ts +16 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +11 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +2 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +22 -0
- package/dist/errors.js.map +10 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +474 -0
- package/dist/index.js.map +14 -0
- package/dist/mcp.d.ts +3 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +689 -0
- package/dist/mcp.js.map +17 -0
- package/dist/params.d.ts +9 -0
- package/dist/params.d.ts.map +1 -0
- package/dist/params.js +37 -0
- package/dist/params.js.map +1 -0
- package/dist/request.d.ts +5 -0
- package/dist/request.d.ts.map +1 -0
- package/dist/request.js +39 -0
- package/dist/request.js.map +1 -0
- package/dist/schemas.d.ts +327 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/types.d.ts +48 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +54 -10
- package/src/config.js +0 -7
- package/src/index.js +0 -227
- package/src/utils.js +0 -56
package/package.json
CHANGED
|
@@ -1,26 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "builtwith-api",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Wrapper for the BuiltWith API",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"builtwith": "./dist/cli.js",
|
|
10
|
+
"builtwith-mcp": "./dist/mcp.js"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./mcp": {
|
|
18
|
+
"types": "./dist/mcp.d.ts",
|
|
19
|
+
"import": "./dist/mcp.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "bun run build:js && bun run build:types && chmod +x dist/cli.js dist/mcp.js",
|
|
24
|
+
"build:js": "bun build ./src/index.ts ./src/cli.ts ./src/mcp.ts ./src/errors.ts --outdir dist --target node --format esm --sourcemap=external --external zod --external @modelcontextprotocol/sdk",
|
|
25
|
+
"build:types": "tsc --emitDeclarationOnly",
|
|
26
|
+
"cli": "bun run src/cli.ts",
|
|
27
|
+
"mcp": "bun run src/mcp.ts",
|
|
28
|
+
"mcp:inspect": "npx @modelcontextprotocol/inspector node dist/mcp.js",
|
|
29
|
+
"compile": "bun run compile:linux-x64 && bun run compile:linux-arm64 && bun run compile:darwin-x64 && bun run compile:darwin-arm64 && bun run compile:windows-x64",
|
|
30
|
+
"compile:linux-x64": "bun build src/cli.ts --compile --target bun-linux-x64 --outfile dist/builtwith-linux-x64",
|
|
31
|
+
"compile:linux-arm64": "bun build src/cli.ts --compile --target bun-linux-arm64 --outfile dist/builtwith-linux-arm64",
|
|
32
|
+
"compile:darwin-x64": "bun build src/cli.ts --compile --target bun-darwin-x64 --outfile dist/builtwith-darwin-x64",
|
|
33
|
+
"compile:darwin-arm64": "bun build src/cli.ts --compile --target bun-darwin-arm64 --outfile dist/builtwith-darwin-arm64",
|
|
34
|
+
"compile:windows-x64": "bun build src/cli.ts --compile --target bun-windows-x64 --outfile dist/builtwith-windows-x64.exe",
|
|
35
|
+
"prepublishOnly": "bun run build",
|
|
36
|
+
"test": "bun test",
|
|
37
|
+
"smoke": "bun test.ts",
|
|
38
|
+
"clean": "rm -rf dist"
|
|
39
|
+
},
|
|
7
40
|
"homepage": "https://github.com/zcaceres/builtwith-api",
|
|
8
41
|
"repository": {
|
|
9
42
|
"type": "git",
|
|
10
43
|
"url": "https://github.com/zcaceres/builtwith-api.git"
|
|
11
44
|
},
|
|
12
45
|
"keywords": [
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
46
|
+
"builtwith",
|
|
47
|
+
"api",
|
|
48
|
+
"cli",
|
|
49
|
+
"mcp",
|
|
50
|
+
"model-context-protocol",
|
|
51
|
+
"technology-detection",
|
|
52
|
+
"web-intelligence"
|
|
53
|
+
],
|
|
54
|
+
"files": [
|
|
55
|
+
"dist"
|
|
16
56
|
],
|
|
17
57
|
"author": "Zach Caceres (@zachcaceres)",
|
|
18
58
|
"license": "MIT",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"node-fetch": "^2.6.0"
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=18.0.0"
|
|
22
61
|
},
|
|
23
62
|
"devDependencies": {
|
|
24
|
-
"
|
|
63
|
+
"@types/bun": "^1.3.9",
|
|
64
|
+
"typescript": "^5"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
68
|
+
"zod": "^4.3.6"
|
|
25
69
|
}
|
|
26
70
|
}
|
package/src/config.js
DELETED
package/src/index.js
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
const _ = require('lodash')
|
|
2
|
-
|
|
3
|
-
const utils = require("./utils")
|
|
4
|
-
const { VALID_RESPONSE_TYPES } = require("./config")
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function BuiltWith(apiKey, moduleParams = {}) {
|
|
8
|
-
const responseFormat = _.get(moduleParams, 'responseFormat', 'json')
|
|
9
|
-
|
|
10
|
-
if (!Object.values(VALID_RESPONSE_TYPES).includes(responseFormat)) {
|
|
11
|
-
throw new Error(`Invalid 'responseFormat'. Valid format are 'xml', 'txt', and 'json'. You input ${responseFormat}`)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (responseFormat === VALID_RESPONSE_TYPES.TXT) {
|
|
15
|
-
console.warn("TXT response format is only supported for the BuiltWith Lists API. See: https://api.builtwith.com/lists-api");
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function constructBuiltWithURL(
|
|
19
|
-
apiName,
|
|
20
|
-
requestParams = {},
|
|
21
|
-
subdomain = 'api'
|
|
22
|
-
) {
|
|
23
|
-
let bwURL = `https://${subdomain}.builtwith.com/${apiName}/api.${responseFormat}?KEY=${apiKey}`
|
|
24
|
-
|
|
25
|
-
if (!_.isEmpty(requestParams)) {
|
|
26
|
-
bwURL += `&${utils.paramsObjToQueryString(requestParams)}`
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return bwURL
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
/**
|
|
35
|
-
* Make a request to the BuiltWith Free API
|
|
36
|
-
*
|
|
37
|
-
* @see https://api.builtwith.com/free-api
|
|
38
|
-
* @param {String} url
|
|
39
|
-
*/
|
|
40
|
-
free: async function(url) {
|
|
41
|
-
const bwURL = constructBuiltWithURL("free1", {
|
|
42
|
-
LOOKUP: url
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const res = await utils.makeStandardRequest(bwURL, responseFormat)
|
|
46
|
-
return res;
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Make a request to the BuiltWith Domain API
|
|
51
|
-
*
|
|
52
|
-
* @see https://api.builtwith.com/domain-api
|
|
53
|
-
* @param {String} url
|
|
54
|
-
* @param {Object} params
|
|
55
|
-
*/
|
|
56
|
-
domain: async function(url, params) {
|
|
57
|
-
const hideAll = _.get(params, "hideAll", false);
|
|
58
|
-
const noMetaData = _.get(params, "noMetaData", false);
|
|
59
|
-
const noAttributeData = _.get(params, "noAttributeData", false);
|
|
60
|
-
const hideDescriptionAndLinks = _.get(
|
|
61
|
-
params,
|
|
62
|
-
"hideDescriptionAndLinks",
|
|
63
|
-
false
|
|
64
|
-
);
|
|
65
|
-
const onlyLiveTechnologies = _.get(params, "onlyLiveTechnologies", false);
|
|
66
|
-
|
|
67
|
-
const bwURL = constructBuiltWithURL("v14", {
|
|
68
|
-
LOOKUP: url,
|
|
69
|
-
HIDETEXT: hideAll,
|
|
70
|
-
HIDEDL: hideDescriptionAndLinks,
|
|
71
|
-
LIVEONLY: onlyLiveTechnologies,
|
|
72
|
-
NOMETA: noMetaData,
|
|
73
|
-
NOATTR: noAttributeData
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
const res = await utils.makeStandardRequest(bwURL, responseFormat);
|
|
77
|
-
|
|
78
|
-
return res;
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Make a request to the BuiltWith Lists API
|
|
83
|
-
*
|
|
84
|
-
* @see: https://api.builtwith.com/lists-api
|
|
85
|
-
* @param {String} technology
|
|
86
|
-
* @param {Object} params
|
|
87
|
-
*/
|
|
88
|
-
lists: async function(technology, params) {
|
|
89
|
-
const includeMetaData = _.get(params, "includeMetaData", false);
|
|
90
|
-
const offset = _.get(params, "offset");
|
|
91
|
-
const since = _.get(params, "since");
|
|
92
|
-
|
|
93
|
-
const bwURL = constructBuiltWithURL("lists5", {
|
|
94
|
-
TECH: technology,
|
|
95
|
-
META: includeMetaData,
|
|
96
|
-
OFFSET: offset,
|
|
97
|
-
SINCE: since
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const res = await utils.makeBulletProofRequest(bwURL)
|
|
101
|
-
return res
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Make a request to the BuiltWith Relationships API
|
|
106
|
-
*
|
|
107
|
-
* @note Relationships API may throw an error related to the maxJSONLength property for certain URLs. This is thrown in BuiltWith and cannot be handled here.
|
|
108
|
-
*
|
|
109
|
-
* @see https://api.builtwith.com/relationships-api
|
|
110
|
-
* @param {String} url
|
|
111
|
-
*/
|
|
112
|
-
relationships: async function(url) {
|
|
113
|
-
const bwURL = constructBuiltWithURL("rv1", {
|
|
114
|
-
LOOKUP: url
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
const res = await utils.makeStandardRequest(bwURL, responseFormat);
|
|
118
|
-
|
|
119
|
-
return res;
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Make a request to the BuiltWith Keywords API
|
|
124
|
-
*
|
|
125
|
-
* @see https://api.builtwith.com/keywords-api
|
|
126
|
-
* @param {String} url
|
|
127
|
-
*/
|
|
128
|
-
keywords: async function(url) {
|
|
129
|
-
const bwURL = constructBuiltWithURL("kw2", {
|
|
130
|
-
LOOKUP: url
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
const res = await utils.makeStandardRequest(bwURL, responseFormat)
|
|
134
|
-
return res;
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Make a request to the BuiltWith Trends API
|
|
139
|
-
*
|
|
140
|
-
* @see: https://api.builtwith.com/trends-api
|
|
141
|
-
* @param {String} technology
|
|
142
|
-
* @param {Object} params
|
|
143
|
-
*/
|
|
144
|
-
trends: async function(technology, params) {
|
|
145
|
-
const date = _.get(params, "date");
|
|
146
|
-
|
|
147
|
-
const bwURL = constructBuiltWithURL("trends/v6", {
|
|
148
|
-
TECH: technology,
|
|
149
|
-
DATE: date
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
const res = await utils.makeBulletProofRequest(bwURL);
|
|
153
|
-
return res
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Make a request to the BuiltWith Company to URL API
|
|
158
|
-
*
|
|
159
|
-
* @see: https://api.builtwith.com/trends-api
|
|
160
|
-
* @param {String} companyName
|
|
161
|
-
* @param {Object} params
|
|
162
|
-
*/
|
|
163
|
-
companyToUrl: async function(companyName, params) {
|
|
164
|
-
const tld = _.get(params, "tld");
|
|
165
|
-
const amount = _.get(params, "noMetaData");
|
|
166
|
-
|
|
167
|
-
const bwURL = constructBuiltWithURL(
|
|
168
|
-
"ctu1",
|
|
169
|
-
{
|
|
170
|
-
COMPANY: encodeURIComponent(companyName),
|
|
171
|
-
TLD: tld,
|
|
172
|
-
AMOUNT: amount
|
|
173
|
-
},
|
|
174
|
-
"ctu"
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
const res = await utils.makeStandardRequest(bwURL, responseFormat)
|
|
178
|
-
return res;
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Make a request to the BuiltWith Domain Live API
|
|
183
|
-
*
|
|
184
|
-
* @see https://api.builtwith.com/domain-live-api
|
|
185
|
-
* @param {String} url
|
|
186
|
-
*/
|
|
187
|
-
domainLive: async function(url) {
|
|
188
|
-
const bwURL = constructBuiltWithURL("dlv1", {
|
|
189
|
-
LOOKUP: url
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
const res = await utils.makeStandardRequest(bwURL, responseFormat)
|
|
193
|
-
return res;
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Make a request to the BuiltWith Domain Live API
|
|
198
|
-
*
|
|
199
|
-
* @see https://api.builtwith.com/trust-api
|
|
200
|
-
* @param {String} url
|
|
201
|
-
* @param {Object} params
|
|
202
|
-
*/
|
|
203
|
-
trust: async function(url, params) {
|
|
204
|
-
const words = _.get(params, "words", "")
|
|
205
|
-
const live = _.get(params, "live", false)
|
|
206
|
-
|
|
207
|
-
const bwURL = constructBuiltWithURL("trustv1", {
|
|
208
|
-
LOOKUP: url,
|
|
209
|
-
// 'wordOne, wordTwo' ==> 'wordOne,wordTwo'
|
|
210
|
-
WORDS: words.split(',').map(wrd => wrd.trim()).join(','),
|
|
211
|
-
LIVE: live
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
const res = await utils.makeStandardRequest(bwURL, responseFormat)
|
|
215
|
-
return res;
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// Constructor to authenticate and get module
|
|
222
|
-
module.exports = function(apiKey, moduleParams) {
|
|
223
|
-
if (!apiKey) {
|
|
224
|
-
throw new Error('You must initialize the BuiltWith module with an api key')
|
|
225
|
-
}
|
|
226
|
-
return BuiltWith(apiKey, moduleParams)
|
|
227
|
-
}
|
package/src/utils.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const fetch = require("node-fetch")
|
|
2
|
-
const { VALID_RESPONSE_TYPES } = require("./config")
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
makeStandardRequest: async function(url, responseFormat) {
|
|
6
|
-
return fetch(url).then(res => {
|
|
7
|
-
if (responseFormat === VALID_RESPONSE_TYPES.XML) {
|
|
8
|
-
return res.text();
|
|
9
|
-
} else {
|
|
10
|
-
return res.json();
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
makeBulletProofRequest: async function(url, responseFormat) {
|
|
16
|
-
const res = await fetch(url);
|
|
17
|
-
if (
|
|
18
|
-
responseFormat === VALID_RESPONSE_TYPES.TXT ||
|
|
19
|
-
responseFormat === VALID_RESPONSE_TYPES.XML
|
|
20
|
-
) {
|
|
21
|
-
return res.text();
|
|
22
|
-
} else {
|
|
23
|
-
/**
|
|
24
|
-
* BuiltWith sends invalid formats as errors, which break JSON parsing.
|
|
25
|
-
*/
|
|
26
|
-
let parsed = await res.text();
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
return JSON.parse(parsed);
|
|
30
|
-
} catch (e) {
|
|
31
|
-
console.warn(
|
|
32
|
-
"BuiltWith sent an invalid JSON payload. Falling back to text parsing."
|
|
33
|
-
);
|
|
34
|
-
return parsed;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Convert a parameters object into a query string, joined by the `&` char
|
|
41
|
-
* { paramOne: 'hello', paramTwo: 'goodbye' }
|
|
42
|
-
* @param {Object} params
|
|
43
|
-
*/
|
|
44
|
-
paramsObjToQueryString: function(params) {
|
|
45
|
-
// '¶mOne=hello¶mTwo=goodbye
|
|
46
|
-
return Object.entries(params) // [['paramOne', 'hello'], ['paramTwo', 'goodbye]]
|
|
47
|
-
.filter(([, value]) => {
|
|
48
|
-
if (value === undefined) return false;
|
|
49
|
-
else return true;
|
|
50
|
-
})
|
|
51
|
-
.map(([key, value]) => {
|
|
52
|
-
return `${key}=${value}`; // ['paramOne=hello', 'paramTwo=goodbye']
|
|
53
|
-
})
|
|
54
|
-
.join("&"); // 'paramOne=hello¶mTwo=goodBye'
|
|
55
|
-
}
|
|
56
|
-
}
|