OpenByteDev/SourceScraper

Problem running SourceScraper

Closed this issue · 3 comments

0. Hello excuse my bad coding my last Java lessons are a few years ago

1. Installing source-scraper

root@stream:~/SourceScraper# npm i source-scraper
npm WARN registry Using stale data from https://registry.npmjs.org/ because the host is inaccessible -- are you offline?
npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.

  • source-scraper@1.2.5
    updated 1 package in 10.133s

2. Open node

root@stream:~/SourceScraper# sudo node

3. Running Script

root@stream:~/SourceScraper# sudo node

const { scrapers } = require('source-scraper');
Error: Cannot find module './TiwikiwiScraper'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)

(async () => {
... const url = 'some url';
... const scraper = scrapers.getFirstApplicable(url);
... const scrap = await scraper.scrap(url);
... if (scrap.success)
... console.log(scrap.data);
... })();
Promise {
ReferenceError: scrapers is not defined
at repl:3:21
at repl:7:3
at ContextifyScript.Script.runInThisContext (vm.js:50:33)
at REPLServer.defaultEval (repl.js:240:29)
at bound (domain.js:301:14)
at REPLServer.runBound [as eval] (domain.js:314:12)
at REPLServer.onLine (repl.js:468:10)
at emitOne (events.js:121:20)
at REPLServer.emit (events.js:211:7)
at REPLServer.Interface._onLine (readline.js:280:10),
domain:
Domain {
domain: null,
_events: { error: [Function: debugDomainError] },
_eventsCount: 1,
_maxListeners: undefined,
members: [] } }
(node:4103) UnhandledPromiseRejectionWarning: ReferenceError: scrapers is not defined
at repl:3:21
at repl:7:3
at ContextifyScript.Script.runInThisContext (vm.js:50:33)
at REPLServer.defaultEval (repl.js:240:29)
at bound (domain.js:301:14)
at REPLServer.runBound [as eval] (domain.js:314:12)
at REPLServer.onLine (repl.js:468:10)
at emitOne (events.js:121:20)
at REPLServer.emit (events.js:211:7)
at REPLServer.Interface._onLine (readline.js:280:10)
(node:4103) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4103) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

4. second try

root@stream:~/SourceScraper# sudo node

const { StreamcloudScraper } = require('streamcloud-scraper@1.0.5');
Error: Cannot find module 'streamcloud-scraper@1.0.5'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)

undefined

(async () => { const url = 'https://streamango.com'; const scrap = await new
... StreamcloudScraper().scrap(url); if (scrap.success)
... console.log(scrap.data.sources);
... })();
Promise {
ReferenceError: StreamcloudScraper is not defined
at repl:1:68
at repl:4:3
at ContextifyScript.Script.runInThisContext (vm.js:50:33)
at REPLServer.defaultEval (repl.js:240:29)
at bound (domain.js:301:14)
at REPLServer.runBound [as eval] (domain.js:314:12)
at REPLServer.onLine (repl.js:468:10)
at emitOne (events.js:121:20)
at REPLServer.emit (events.js:211:7)
at REPLServer.Interface._onLine (readline.js:280:10),
domain:
Domain {
domain: null,
_events: { error: [Function: debugDomainError] },
_eventsCount: 1,
_maxListeners: undefined,
members: [] } }
(node:4123) UnhandledPromiseRejectionWarning: ReferenceError: StreamcloudScraper is not defined
at repl:1:68
at repl:4:3
at ContextifyScript.Script.runInThisContext (vm.js:50:33)
at REPLServer.defaultEval (repl.js:240:29)
at bound (domain.js:301:14)
at REPLServer.runBound [as eval] (domain.js:314:12)
at REPLServer.onLine (repl.js:468:10)
at emitOne (events.js:121:20)
at REPLServer.emit (events.js:211:7)
at REPLServer.Interface._onLine (readline.js:280:10)
(node:4123) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4123) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

5. Help Please

What version of NodeJS are you using?

Sry late reply my NodeJS and npm version is:

SourceScraper# node -v
v10.12.0

SourceScraper# npm -v
6.4.1

Thanks for your help

As you could probably tell by my silence until now, I couldn't figure it out and I do not know what could cause this.