@xapp/arachne-cli 0.0.2 → 0.4.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.md +176 -0
- package/README.md +29 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +194 -11
- package/lib/index.js.map +1 -1
- package/package.json +28 -21
package/LICENSE.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
## @xapp/arachne-cli
|
|
2
|
+
|
|
3
|
+
### Example Usage
|
|
4
|
+
|
|
5
|
+
To crawl a site and save the pages to a local ./temp directory
|
|
6
|
+
```
|
|
7
|
+
node lib crawl http://www.thecoffeefaq.com/ -d ./temp
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
To also save markdown and schema.org FAQs
|
|
11
|
+
```
|
|
12
|
+
node lib crawl http://www.thecoffeefaq.com/ -a -t -d ./temp
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
With a whitelisted patterns file
|
|
16
|
+
```
|
|
17
|
+
node lib crawl http://www.thecoffeefaq.com/ -a -t -d ./temp -w ./temp/whitelist.md
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Windows & WSL2 Notes
|
|
21
|
+
|
|
22
|
+
Follow the instructions here to setup: https://github.com/puppeteer/puppeteer/issues/1837#issuecomment-689006806
|
|
23
|
+
|
|
24
|
+
You __will__ need to start XLaunch before running the CLI, select multiple windows, no client, turn off access control.
|
|
25
|
+
|
|
26
|
+
If the normal commands don't work, you might need to pass in the executablePath (-e) and run headless (-h).
|
|
27
|
+
```
|
|
28
|
+
node lib crawl http://www.thecoffeefaq.com/ -e /usr/bin/google-chrome -h
|
|
29
|
+
```
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
"use strict";
|
|
2
3
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
4
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -8,27 +9,209 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
9
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
10
|
});
|
|
10
11
|
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
11
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
/*! Copyright (c) 2020, XAPP AI */
|
|
17
|
+
/* eslint-disable no-console */
|
|
12
18
|
const arachne_1 = require("@xapp/arachne");
|
|
19
|
+
const arachne_parsers_1 = require("@xapp/arachne-parsers");
|
|
20
|
+
const url_1 = require("url");
|
|
21
|
+
const fs_1 = require("fs");
|
|
22
|
+
const path_1 = require("path");
|
|
23
|
+
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
24
|
+
const helpers_1 = require("yargs/helpers");
|
|
25
|
+
const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
26
|
+
.command('crawl <url>', 'Crawl the provided URL', (yargs) => {
|
|
27
|
+
yargs.positional("url", { type: 'string', alias: ["u"], demandOption: true, describe: "The URL to crawl" });
|
|
28
|
+
})
|
|
29
|
+
.options({
|
|
30
|
+
a: { type: 'boolean', alias: ["faq"], default: false, describe: "Generate a JSON file with FAQs, AWS Kendra format, found in JSON+LD while crawling." },
|
|
31
|
+
d: { type: 'string', alias: ["dir"], describe: "The directory to save the HTML source to" },
|
|
32
|
+
e: { type: 'string', alias: ["executablePath"], describe: "Executable path Chrome" },
|
|
33
|
+
h: { type: 'boolean', alias: ["headless"], default: false },
|
|
34
|
+
m: { type: 'number', alias: ["max"], default: 1000, describe: "The max number of total crawls." },
|
|
35
|
+
o: { type: 'number', alias: ["timeout"], default: 4000, describe: "The timeout for each individual page load." },
|
|
36
|
+
p: { type: 'number', alias: ["pages"], default: 10, describe: "The max number of pages (tabs) running simultaneously." },
|
|
37
|
+
s: { type: 'boolean', alias: ["stealth"], describe: "Turns on stealth mode" },
|
|
38
|
+
t: { type: 'boolean', alias: ["markdown", "text"], default: false, describe: "When a directory is provided, this will also save a markdown version of the HTML." },
|
|
39
|
+
w: { type: 'string', alias: ["whitelist"], describe: "A text file where each line is a whitelisted pattern" },
|
|
40
|
+
x: { type: 'boolean', alias: ["metadata"], describe: "Generate a JSON metadata file for Amazon Kendra" }
|
|
41
|
+
})
|
|
42
|
+
.nargs('u', 1)
|
|
43
|
+
.parseSync();
|
|
44
|
+
argv;
|
|
45
|
+
const inputURL = argv.url;
|
|
46
|
+
const url = new url_1.URL(inputURL);
|
|
47
|
+
const cleanHost = url.host.replace(/\./g, "_");
|
|
48
|
+
const cleanPath = url.pathname.replace(/\//g, "_");
|
|
49
|
+
let patterns;
|
|
50
|
+
const whiteListPath = argv.w;
|
|
51
|
+
if (whiteListPath) {
|
|
52
|
+
console.log(whiteListPath);
|
|
53
|
+
const resolvedPath = (0, path_1.resolve)(whiteListPath);
|
|
54
|
+
const contents = (0, fs_1.readFileSync)(resolvedPath, "utf-8");
|
|
55
|
+
patterns = contents.split("\n");
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
patterns = inputURL.endsWith("/") ? [`${inputURL}[.*]`] : [`${inputURL}/[.*]`];
|
|
59
|
+
}
|
|
60
|
+
const directory = Array.isArray(argv.d) ? argv.d[1] : argv.d;
|
|
61
|
+
const path = directory ? (0, path_1.resolve)(directory) : undefined;
|
|
62
|
+
if (path) {
|
|
63
|
+
// Make sure it exists
|
|
64
|
+
if (!(0, fs_1.existsSync)(path)) {
|
|
65
|
+
throw new Error(`Path ${directory} does not exist. Please provide an existing path to save the HTML`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
let saveDir;
|
|
69
|
+
if (path) {
|
|
70
|
+
const exportDirName = `${cleanHost}${cleanPath}-${new Date().getTime()}`;
|
|
71
|
+
saveDir = (0, path_1.resolve)(path, exportDirName);
|
|
72
|
+
(0, fs_1.mkdirSync)(saveDir);
|
|
73
|
+
}
|
|
13
74
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
75
|
const queue = new arachne_1.MemoryRequestQueue();
|
|
15
|
-
queue.addRequest({ url:
|
|
16
|
-
const
|
|
76
|
+
queue.addRequest({ url: inputURL });
|
|
77
|
+
const crawlPatterns = patterns.map((pattern) => new arachne_1.ArachneURLPattern(pattern));
|
|
78
|
+
const answers = new Map();
|
|
79
|
+
console.log(`Starting crawl at ${inputURL}`);
|
|
17
80
|
const crawler = arachne_1.Arachne.crawler({
|
|
18
|
-
maxConcurrentPages:
|
|
19
|
-
maxCrawlAttempts:
|
|
20
|
-
|
|
81
|
+
maxConcurrentPages: argv.p,
|
|
82
|
+
maxCrawlAttempts: argv.m,
|
|
83
|
+
pageHandlerTimeout: argv.o,
|
|
84
|
+
stealth: argv.s,
|
|
85
|
+
launchOptions: { headless: argv.h, timeout: 5000, executablePath: argv.e },
|
|
21
86
|
queue,
|
|
22
|
-
pageHandler: (request,
|
|
87
|
+
pageHandler: (page, request, response) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
88
|
const title = yield page.title();
|
|
24
|
-
console.log(`Loaded ${request.url}: ${title}`);
|
|
25
|
-
|
|
89
|
+
console.log(`Loaded ${request.url} : ${title}`);
|
|
90
|
+
// Get the raw HTML
|
|
91
|
+
// It is important to use page.content() versus response.text() since
|
|
92
|
+
// page.content() gets you the HTML after it has been modified by the JavaScript
|
|
93
|
+
// on the page while response.text() only gives you the HTML from the original GET
|
|
94
|
+
const text = yield page.content();
|
|
95
|
+
// Pull out the raw html
|
|
96
|
+
if (saveDir) {
|
|
97
|
+
const requestURL = new url_1.URL(request.url);
|
|
98
|
+
const cleanHost = requestURL.host.replace(/(\.|\/)/g, "_");
|
|
99
|
+
const cleanRequestPath = requestURL.pathname.replace(/\//g, "_").replace(".html", "");
|
|
100
|
+
const htmlName = `${cleanHost}_${cleanRequestPath}.html`;
|
|
101
|
+
console.log(`File Name: ${htmlName}`);
|
|
102
|
+
const filePath = (0, path_1.resolve)(saveDir, htmlName);
|
|
103
|
+
console.log(`Saving to ${filePath}`);
|
|
104
|
+
(0, fs_1.writeFileSync)(filePath, text);
|
|
105
|
+
if (argv.x) {
|
|
106
|
+
const date = new Date().toISOString();
|
|
107
|
+
// Doc title
|
|
108
|
+
const metadata = {
|
|
109
|
+
Attributes: {
|
|
110
|
+
_created_at: date,
|
|
111
|
+
_source_uri: request.url,
|
|
112
|
+
_last_updated_at: date
|
|
113
|
+
},
|
|
114
|
+
Title: title,
|
|
115
|
+
ContentType: "HTML"
|
|
116
|
+
};
|
|
117
|
+
const metadataFileName = `${htmlName}.metadata.json`;
|
|
118
|
+
const metadataFilePath = (0, path_1.resolve)(saveDir, metadataFileName);
|
|
119
|
+
console.log(`Saving metadata to ${metadataFilePath}`);
|
|
120
|
+
const metadataText = JSON.stringify(metadata, undefined, 2);
|
|
121
|
+
(0, fs_1.writeFileSync)(metadataFilePath, metadataText);
|
|
122
|
+
}
|
|
123
|
+
if (argv.t) {
|
|
124
|
+
// Write some MARKDOWN!
|
|
125
|
+
const markdown = new arachne_parsers_1.ArachneHTMLtoText().convert(text, true);
|
|
126
|
+
const markdownName = `${cleanRequestPath}.md`;
|
|
127
|
+
const markdownFilePath = (0, path_1.resolve)(saveDir, markdownName);
|
|
128
|
+
console.log(`Saving markdown to ${markdownFilePath}`);
|
|
129
|
+
(0, fs_1.writeFileSync)(markdownFilePath, markdown);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// Let's see if we can find some structured data.
|
|
133
|
+
const questions = new arachne_parsers_1.ArachneJSONLD(text).getQuestions();
|
|
134
|
+
if (questions.length > 0) {
|
|
135
|
+
console.log(`${questions.length} questions found on page.`);
|
|
136
|
+
// Clean the answer
|
|
137
|
+
questions.forEach((question) => {
|
|
138
|
+
// name has the question text
|
|
139
|
+
// acceptedAnswer has the answer text
|
|
140
|
+
const questionText = typeof question.name === "string" ? question.name : "";
|
|
141
|
+
const acceptedAnswer = question.acceptedAnswer;
|
|
142
|
+
if (acceptedAnswer && (0, arachne_parsers_1.isAnswer)(acceptedAnswer)) {
|
|
143
|
+
const answerText = typeof acceptedAnswer.text === "string" ? acceptedAnswer.text : "";
|
|
144
|
+
if (answerText.length > 0) {
|
|
145
|
+
// Clean it
|
|
146
|
+
const cleanAnswer = new arachne_parsers_1.ArachneHTMLtoText().convert(answerText);
|
|
147
|
+
let existingAnswer = answers.get(cleanAnswer);
|
|
148
|
+
if (existingAnswer) {
|
|
149
|
+
existingAnswer.questions.push(questionText);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
existingAnswer = {
|
|
153
|
+
answer: cleanAnswer,
|
|
154
|
+
questions: [questionText],
|
|
155
|
+
url: request.url
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
// Add it back!
|
|
159
|
+
answers.set(cleanAnswer, existingAnswer);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
yield (0, arachne_1.enqueueLinks)(page, queue, crawlPatterns);
|
|
26
165
|
const info = yield queue.getInfo();
|
|
27
|
-
console.log(`Completed ${info.completeRequests} of ${info.totalRequests}
|
|
166
|
+
console.log(`Completed ${info.completeRequests} of ${info.totalRequests}, ${info.inProgressRequests} are in progress with ${info.pendingRequests} pending and ${info.failedRequests} failed.`);
|
|
28
167
|
})
|
|
29
168
|
});
|
|
30
|
-
|
|
169
|
+
try {
|
|
170
|
+
yield crawler.run();
|
|
171
|
+
}
|
|
172
|
+
catch (e) {
|
|
173
|
+
console.log('Unable to start the crawler.');
|
|
174
|
+
console.error(e);
|
|
175
|
+
}
|
|
176
|
+
console.log('Crawler complete.');
|
|
31
177
|
const info = yield queue.getInfo();
|
|
32
|
-
console.log(`Final count, completed ${info.completeRequests} of ${info.totalRequests}
|
|
178
|
+
console.log(`Final count, completed ${info.completeRequests} of ${info.totalRequests}, ${info.failedRequests} failed.`);
|
|
179
|
+
const failed = queue.getFailed();
|
|
180
|
+
if (failed.length > 0) {
|
|
181
|
+
console.log('Failures....');
|
|
182
|
+
failed.forEach((failedRequest) => {
|
|
183
|
+
console.log(`\t${failedRequest.url} failed after ${failedRequest.requestAttempts} attempts with final error: ${failedRequest.errorMessages ? failedRequest.errorMessages[failedRequest.errorMessages.length - 1] : "unknown"}`);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
console.log(`Found ${answers.size} answers.`);
|
|
187
|
+
if (argv.faq && saveDir) {
|
|
188
|
+
// This follows the JSON format https://docs.aws.amazon.com/kendra/latest/dg/in-creating-faq.html#faq-custom-json
|
|
189
|
+
const qaJSON = {
|
|
190
|
+
"SchemaVersion": 1,
|
|
191
|
+
"FaqDocuments": []
|
|
192
|
+
};
|
|
193
|
+
let qaCSV = `"Question","Answer","URL"`;
|
|
194
|
+
answers.forEach((answer) => {
|
|
195
|
+
// For the questions on the answer, add a line
|
|
196
|
+
answer.questions.forEach((question) => {
|
|
197
|
+
qaJSON.FaqDocuments.push({
|
|
198
|
+
Question: question,
|
|
199
|
+
Answer: answer.answer,
|
|
200
|
+
Attributes: {
|
|
201
|
+
_source_uri: answer.url
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
qaCSV += `\r\n"${question}","${answer.answer}","${answer.url}"`;
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
const questionAnswerName = `question-answers.json`;
|
|
208
|
+
const qaFilePath = (0, path_1.resolve)(saveDir, questionAnswerName);
|
|
209
|
+
console.log(`Saving FAQ JSON to ${qaFilePath}`);
|
|
210
|
+
(0, fs_1.writeFileSync)(qaFilePath, JSON.stringify(qaJSON, undefined, 2));
|
|
211
|
+
const csvQuestionName = `question-answers.csv`;
|
|
212
|
+
const csvQaFilePath = (0, path_1.resolve)(saveDir, csvQuestionName);
|
|
213
|
+
console.log(`Saving FAQ CSV to ${csvQaFilePath}`);
|
|
214
|
+
(0, fs_1.writeFileSync)(csvQaFilePath, qaCSV);
|
|
215
|
+
}
|
|
33
216
|
}))();
|
|
34
217
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kCAAkC;AAClC,+BAA+B;AAC/B,2CAQuB;AAEvB,2DAAmF;AAEnF,6BAA0B;AAC1B,2BAAwE;AACxE,+BAA+B;AAE/B,wDAAgC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AC,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,qBAAqB,aAAa,EAAE,CAAC,CAAC;QAClD,IAAA,kBAAa,EAAC,aAAa,EAAE,KAAK,CAAC,CAAC;KACvC;AACL,CAAC,CAAA,CAAC,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,44 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xapp/arachne-cli",
|
|
3
|
-
"
|
|
3
|
+
"preferGlobal": true,
|
|
4
|
+
"version": "0.4.0",
|
|
4
5
|
"types": "lib/index",
|
|
5
6
|
"main": "lib/index",
|
|
6
7
|
"files": [
|
|
7
8
|
"lib"
|
|
8
9
|
],
|
|
10
|
+
"bin": {
|
|
11
|
+
"arachne": "lib/index"
|
|
12
|
+
},
|
|
13
|
+
"license": "Apache-2.0",
|
|
9
14
|
"private": false,
|
|
10
15
|
"publishConfig": {
|
|
11
16
|
"access": "public"
|
|
12
17
|
},
|
|
13
18
|
"engines": {
|
|
14
|
-
"node": "10
|
|
19
|
+
"node": "^10 || ^12 || ^14"
|
|
15
20
|
},
|
|
16
21
|
"devDependencies": {
|
|
17
|
-
"@microsoft/api-extractor": "7.
|
|
18
|
-
"@types/chai": "4.
|
|
19
|
-
"@types/generic-pool": "3.1.
|
|
20
|
-
"@types/mocha": "
|
|
21
|
-
"@types/node": "
|
|
22
|
-
"@types/puppeteer": "
|
|
23
|
-
"@types/sinon": "
|
|
24
|
-
"@types/sinon-chai": "3.2.
|
|
22
|
+
"@microsoft/api-extractor": "7.22.2",
|
|
23
|
+
"@types/chai": "4.3.1",
|
|
24
|
+
"@types/generic-pool": "3.1.10",
|
|
25
|
+
"@types/mocha": "9.1.1",
|
|
26
|
+
"@types/node": "17.0.25",
|
|
27
|
+
"@types/puppeteer": "5.4.5",
|
|
28
|
+
"@types/sinon": "10.0.11",
|
|
29
|
+
"@types/sinon-chai": "3.2.8",
|
|
30
|
+
"@types/yargs": "17.0.10",
|
|
25
31
|
"@xapp/config": "0.2.3",
|
|
26
|
-
"chai": "4.
|
|
27
|
-
"mocha": "
|
|
28
|
-
"sinon": "
|
|
29
|
-
"sinon-chai": "3.
|
|
30
|
-
"ts-node": "
|
|
31
|
-
"tslib": "2.0
|
|
32
|
-
"typescript": "4.
|
|
32
|
+
"chai": "4.3.6",
|
|
33
|
+
"mocha": "9.2.2",
|
|
34
|
+
"sinon": "13.0.2",
|
|
35
|
+
"sinon-chai": "3.7.0",
|
|
36
|
+
"ts-node": "10.7.0",
|
|
37
|
+
"tslib": "2.4.0",
|
|
38
|
+
"typescript": "4.6.3"
|
|
33
39
|
},
|
|
34
40
|
"dependencies": {
|
|
35
|
-
"@xapp/arachne": "
|
|
41
|
+
"@xapp/arachne": "0.4.0",
|
|
42
|
+
"@xapp/arachne-parsers": "0.4.0",
|
|
43
|
+
"yargs": "17.4.1"
|
|
36
44
|
},
|
|
37
45
|
"scripts": {
|
|
38
46
|
"api": "api-extractor run --local",
|
|
39
47
|
"build": "tsc -d true -p .",
|
|
40
|
-
"clean": "rm -rf ./lib/*"
|
|
41
|
-
"test": "mocha --recursive -r ts-node/register \"./src/**/*.test.ts\""
|
|
48
|
+
"clean": "rm -rf ./lib/*"
|
|
42
49
|
},
|
|
43
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "5fb12fa2701e8a62a892c3c1a3d6865eb5aadcc5"
|
|
44
51
|
}
|