Update index.mjs

This commit is contained in:
The Ghost of FOSS' Future 2024-09-15 19:29:45 -05:00 committed by GitHub
parent 93141df1d3
commit fe59ffa0a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -117,17 +117,18 @@ function generateSearchTerm(hostname) {
const contexts = []; const contexts = [];
async function siteCrawler(hostname) { async function siteCrawler(hostname) {
const crawled = generateSearchTerm(hostname);
const compiledConvert = compile({ wordwrap: 130 });
const loader = new RecursiveUrlLoader(crawled, {
extractor: compiledConvert,
maxDepth: 6,
excludeDirs: ["https://search.sparksammy.com/", "https://search.sparksammy.com/search.php", "https://archive.org", "https://doubleclick.net", "https://paypal.com"],
});
try { try {
const crawled = generateSearchTerm(hostname);
const compiledConvert = compile({ wordwrap: 130 });
const loader = new RecursiveUrlLoader(crawled, {
extractor: compiledConvert,
maxDepth: 6,
excludeDirs: ["https://search.sparksammy.com/", "https://search.sparksammy.com/search.php", "https://archive.org", "https://doubleclick.net", "https://paypal.com"],
});
const webContents = await loader.load(); const webContents = await loader.load();
webContents.forEach(content => contexts.push(content)); webContents.forEach(content => contexts.push(content));
return webContents; return webContents;