MCPcopy Create free account
hub / github.com/omkarcloud/botasaurus / getInputJs

Method getInputJs

js/botasaurus-server-js/src/server.ts:406–418  ·  view source on GitHub ↗
(scraperName: string)

Source from the content-addressed store, hash-verified

404 }
405
406 getInputJs(scraperName: string): string {
407 const inputJsPath = getInputFilePath(scraperName)
408 let inputJs: string | null = null;
409
410 if (fs.existsSync(inputJsPath)) {
411 inputJs = replaceFileTypesInCode(fs.readFileSync(inputJsPath, 'utf-8'));
412 } else {
413 const scraperFilePath = getInputFilePath(scraperName)
414 throw new Error(`Input js file not found for ${scraperName}, at path ${scraperFilePath}. Kindly create it.`);
415 }
416
417 return inputJs;
418 }
419
420 getScrapingFunction(scraperName: string): Function {
421 return this.scrapers[scraperName].function;

Callers 1

getScrapersConfigMethod · 0.95

Calls 2

getInputFilePathFunction · 0.90
replaceFileTypesInCodeFunction · 0.85

Tested by

no test coverage detected