Created
March 23, 2019 14:03
-
-
Save yarl/2ebdda8d1c6579d92dbb0fb1797b028d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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