Public
Edited
May 17, 2023
Insert cell
Insert cell
Insert cell
url = "https://anthologiagraeca.org/api"
Insert cell
data = (await fetch(url, {
method: 'GET',
headers: { 'Content-Type': 'application/json' },
})).json()
Insert cell
Insert cell
d3.json(url)
Insert cell
exemplePassage = anthologyPassages.results[0]
Insert cell
anthologyPassages = (await fetchp(anthologyData.passages)).json()
Insert cell
anthologyData.passages
Insert cell
anthologyData = (await fetchp(url)).json()
Insert cell
data1 = fetch("https://anthologiagraeca.org/api/authors/?format=json").then((response) => response.json())
Insert cell
rivmData = (await fetchp("https://data.rivm.nl/covid-19/COVID-19_reproductiegetal.json")).json()
Insert cell
import { fetchp } from "@tomlarkworthy/fetchp"
Insert cell

function callAPI(i, artworks, pageNbr) {
console.log(i)
fetch(`https://picasso.iro.umontreal.ca/~mona/api/v2/artworks?paginate=50&page=${i}`)
.then(function(response) {
if (response.status >= 400) {
throw new Error("Bad response from server");
}
return response.json();
})
.then(function(data) {

console.log("data response length", data.data.length)
artworks = artworks.concat(data.data)

console.log("artworks length", artworks.length)


if (i < pageNbr)
callAPI(i+1, artworks, pageNbr)
else {
console.log(artworks.length)
// fs.writeJSONSync('../data/artworks_v2_2022-07-28.json', artworks, {spaces: 2, encoding: 'utf8'});
return artworks;
}

})

}


Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more