Public
Edited
May 13, 2023
1 fork
Insert cell
import { SearchForm } from "@floatingpurr/input-autocomplete"
Insert cell
viewof article = SearchForm({
placeholder: "Type-in to search...",
description: "Searching en.wikipedia.org entities",
suggestion: async (text) => {
const res = await d3.json(
`https://en.wikipedia.org/w/api.php?action=opensearch&format=json&search=${text}&namespace=0&limit=10&origin=*`
);
return res[1];
}
})
Insert cell

data = {
var data = [];
let rvcont="";
while(rvcont !== undefined){
let response = await fetch(`https://fr.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=timestamp|size&titles=${titre}&format=json&rvlimit=max&origin=*&${rvcont}`);

let rep = await response.json();
let pageid=Object.keys(rep.query.pages)[0];
data = [...data, ...rep.query.pages[pageid].revisions]
if("batchcomplete" in rep){
console.log(data);
return data;
}
rvcont=`continue=${rep.continue.continue}&rvcontinue=${rep.continue.rvcontinue}`;
}
return data;
}
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more