fix naming

This commit is contained in:
2020-05-24 21:32:26 +03:00
parent 1b22ac4ceb
commit 4666f95b43
4 changed files with 8 additions and 10 deletions

View File

@@ -6,6 +6,7 @@ module.exports = {
},
extends: ['airbnb'],
rules: {
'lines-between-class-members': 0
}
'lines-between-class-members': 0,
'no-console': 0,
},
};

View File

@@ -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;
}

View File

@@ -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;
}