Public
Edited
Dec 28
Importers
3 stars
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

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