Updated with new scraper

This commit is contained in:
Martin Donnelly 2019-02-19 15:57:16 +00:00
parent dfb104d30b
commit fe7868b71c
3 changed files with 3241 additions and 4 deletions

5
app.js
View File

@ -6,7 +6,7 @@ const log4js = require('log4js');
const logger = log4js.getLogger();
const cron = require('node-cron');
const retriever = require('./libs/retriever');
const {retrieveNew} = require('./libs/retriever');
logger.level = 'debug';
@ -38,9 +38,10 @@ cron.schedule('10 15 * * 2,5', () => {
});
cron.schedule('45 9 * * 3,6', () => {
retriever();
retrieveNew();
return -1;
});
logger.info('Lot V3 started...');

File diff suppressed because one or more lines are too long

View File

@ -19,8 +19,13 @@ function retrieveNew() {
const ystring = fecha.format(yesterday, '/DD-MM-YYYY');
const lotData = jsonfile.readFileSync(file);
const u = `https://www.euro-millions.com/results${ystring}`;
fetch(`https://www.euro-millions.com/results${ystring}`)
console.log('retrieving:', u);
// https://www.euro-millions.com/results/15-02-2019
fetch(u)
.then(res => res.text())
.then(body => {
const m = scrapeResults(body);