solution.js

 avatar
unknown
javascript
4 years ago
444 B
3
Indexable
const fs = require('fs');
const {
    getResults,
    getResultDetails
} = require('./scraper.js');

(async () => {
    let solution = {
        articles: []
    };
    let links = await getResults()
    for (const link of links) {
        const results = await getResultDetails(link);
        solution.articles.push(results);
    }
    let jsonString = JSON.stringify(solution);
    fs.writeFileSync('solution.json', jsonString, 'utf-8');
})()
Editor is loading...