diff --git a/.eslintrc.js b/.eslintrc.js index c7fce7f..22a096f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,6 +6,7 @@ module.exports = { }, extends: ['airbnb'], rules: { - 'lines-between-class-members': 0 - } + 'lines-between-class-members': 0, + 'no-console': 0, + }, }; diff --git a/src/cookies/CookieMonster.js b/src/api/Fetcher.js similarity index 100% rename from src/cookies/CookieMonster.js rename to src/api/Fetcher.js diff --git a/src/components/Scraper.js b/src/components/Scraper.js index bc471be..365cb0a 100644 --- a/src/components/Scraper.js +++ b/src/components/Scraper.js @@ -9,7 +9,7 @@ class Scraper { setContent(text) { const parsedContent = new JSDOM(text).window.document; if (parsedContent.querySelector(Selectors.properties.main.container) === null) { - throw Error('No data was received. Cookie is probably expired.'); + throw Error('No data was received.. Something went wrong.'); } this.document = parsedContent; } diff --git a/src/index.js b/src/index.js index ee3e9da..e640952 100644 --- a/src/index.js +++ b/src/index.js @@ -1,19 +1,16 @@ -import Car from './model/Car'; import Cache from './util/Cache'; import Scraper from './components/Scraper'; -import CookieMonster from './cookies/CookieMonster'; +import Fetcher from './api/Fetcher'; class Hack { scraper; - cache; - - cookieMonster; + fetcher; constructor() { this.scraper = new Scraper(); this.cache = new Cache(); - this.cookieMonster = new CookieMonster(this.cache); + this.fetcher = new Fetcher(this.cache); } async getData(plate) { @@ -22,7 +19,7 @@ class Hack { console.log(`Using cached data for ${plate}`); return cached; } - const data = await this.cookieMonster.init(plate); + const data = await this.fetcher.init(plate); this.cache.save(plate, data); return data; }