Skip to content

Instantly share code, notes, and snippets.

@yarl
Created March 23, 2019 14:03
Show Gist options
  • Save yarl/2ebdda8d1c6579d92dbb0fb1797b028d to your computer and use it in GitHub Desktop.
Save yarl/2ebdda8d1c6579d92dbb0fb1797b028d to your computer and use it in GitHub Desktop.
const axios = require('axios');
const cheerio = require('cheerio');
let page = 1;
const maxPage = 100;
function start() {
const url = `https://audiovis.nac.gov.pl/zespol/2:${page}/`;
axios.get(url)
.then((response) => {
const $ = cheerio.load(response.data);
let urls = [];
$('#content > div.center > div > div.box_content > div > a')
.each((index, element) => {
urls.push($(element)
.attr('href'));
});
urls = urls
.map(fileId => `https://audiovis.nac.gov.pl${fileId}`)
.join('\n');
console.log(`-- ${page} --`);
console.log(urls);
page += 1;
if (page <= maxPage) { start(); }
});
}
start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment