fix naming
This commit is contained in:
@@ -6,6 +6,7 @@ module.exports = {
|
||||
},
|
||||
extends: ['airbnb'],
|
||||
rules: {
|
||||
'lines-between-class-members': 0
|
||||
}
|
||||
'lines-between-class-members': 0,
|
||||
'no-console': 0,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
11
src/index.js
11
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user