Public
Edited
Dec 28
Importers
3 stars
Also listed in…
Wikipedia tools
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = {
let result = [];
let offset = "";
while (offset !== undefined) {
let data = await get_pagescreated({
username: username,
wikipedia: wikipedia,
offset: offset
});
offset = data.continue;
result = result.concat(aq.from(Object.values(data.pages[0])));
yield result;
}
return result;
}
Insert cell
df = data[0].union(data)
Insert cell
results = await Promise.all(
df.array("page_title").map((d) =>
get_articleinfo({
article: d,
wikipedia: wikipedia
})
)
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
Insert cell
Insert cell
get_articleinfo0 = ({ article, wikipedia = "en.wikipedia.org" }) => {
return fetch(
`https://xtools.wmcloud.org/api/page/articleinfo/` +
wikipedia +
`/` +
article
).then((d) => d.json());
}
Insert cell
get_articleinfo0({
article: "Economics",
wikipedia: "en.wikipedia.org"
})
Insert cell
get_articleinfo = ({ article, wikipedia = "en.wikipedia.org" }) => {
return fetch(
`https://xtools.wmcloud.org/api/page/articleinfo/` +
wikipedia +
`/` +
article
)
.then((d) => d.json())
.then((d) =>
aq.table({
article: [article],
watchers: [d["watchers"]],
pageviews: [d["pageviews"]],
revisions: [d["revisions"]],
editors: [d["editors"]]
})
);
}
Insert cell
Insert cell
function sparkbar(max) {
return (x) => htl.html`<div style="
background: #F2D7D9;
color: #748DA6;
width: ${(100 * x) / max}%;
float: left;
padding-right: 3px;
padding-left: 3px;
box-sizing: border-box;
overflow: visible;
display: flex;
justify-content: start;">${x.toLocaleString("en")}`;
}
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