Public
Edited
Feb 22, 2024
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
get_categorymembers = ({ category, wikipedia = "en.wikipedia.org" }) => {
let url =
`https://` +
wikipedia +
`/w/api.php?action=query&list=categorymembers&cmlimit=500&cmtitle=Category:` +
category +
`&format=json&origin=*`;
return fetch(url)
.then((d) => d.json())
.then((d) => d.query.categorymembers);
}
Insert cell
Insert cell
categories = get_categorymembers({
category: "Wikipédia:Sondage clos",
wikipedia: "fr.wikipedia.org"
})
Insert cell
Insert cell
cat_list = categories
.map((d) => d.title.replace("Catégorie:", ""))
.concat(["Wikipédia:Sondage en cours"])
Insert cell
Insert cell
pages = get_categorymembers({ category: cat, wikipedia: "fr.wikipedia.org" })
Insert cell
Insert cell
Insert cell
Insert cell
pagesinfo = await Promise.all(
pages.map((d) =>
get_articleinfo({
article: d.title,
wikipedia: "fr.wikipedia.org"
})
)
)
Insert cell
Insert cell
df_pagesinfo = aq
.table({
article: "",
watchers: NaN,
pageviews: NaN,
revisions: NaN,
editors: NaN
})
.union(pagesinfo)
.derive({ name: (d) => op.replace(d.article, "Wikipédia:", "") })
Insert cell
df_pagesinfo.view()
Insert cell
import { aq, op } from "@uwdata/arquero"
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