Unlisted
Edited
Feb 21, 2024
2 forks
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
get_categorymembers({
category: "Wikipédia:Sondage_clos_en_2022",
wikipedia: "fr.wikipedia.org"
})
Insert cell
Insert cell
closed_polls_cat = get_categorymembers({
category: "Wikipédia:Sondage clos",
wikipedia: "fr.wikipedia.org"
})
Insert cell
Insert cell
all_closed_polls = await Promise.all(
closed_polls_cat.map((d) =>
get_categorymembers({
category: d.title.replace("Catégorie:", ""),
wikipedia: "fr.wikipedia.org"
})
)
)
Insert cell
Insert cell
all_closed_polls_concat = [].concat.apply([], all_closed_polls)
Insert cell
all_closed_polls_concat.map((d) => d.title)
Insert cell
Insert cell
results = await Promise.all(
all_closed_polls_concat.map((d) =>
get_articleinfo({
article: d.title,
wikipedia: "fr.wikipedia.org"
})
)
)
Insert cell
df_results = aq
.table({
article: "",
watchers: NaN,
pageviews: NaN,
revisions: NaN,
editors: NaN
})
.union(results)
Insert cell
Inputs.table(df_results, { columns: ["article", "editors"] })
Insert cell
df_results.orderby(aq.desc("editors")).select(["article", "editors"]).view()
Insert cell
import { get_articleinfo } from "@pac02/look-at-your-list-of-created-articles-with-the-xtools-page-ar"
Insert cell
import { aq, op } from "@uwdata/arquero"
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