Public
Edited
Mar 23, 2024
71 stars
Insert cell
Insert cell
Insert cell
Insert cell
md`${content}`
Insert cell
Insert cell
devmode = false
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
devmode
? Inputs.table(labelled100, {
columns: ["thumbnail", "url", "title", "author", "score", "catagory"],
sort: "score",
reverse: true,
rows: 50,
format: {
thumbnail: (t) =>
html`<a href=${
data.find((d) => d.thumbnail === t)?.url
} target=_blank><img width=100% src=${t}>`
}
})
: undefined
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
viewof fetchMeta = Inputs.toggle({
label: "fetch doc meta? (network, slow)"
})
Insert cell
Insert cell
meta = FileAttachment("fetchedMeta.json").json()
Insert cell
Insert cell
Insert cell
Insert cell
viewof fetchLikes = Inputs.toggle({
label: "fetch notebook likes? (network, slow)"
})
Insert cell
fetchedLikes = {
if (!fetchLikes) return invalidation;
const likes = new Array(tweets.length);
for (let i = 0; i < tweets.length; i++) {
if (metadata[i]) {
const html = await (await fetchp(metadata[i].url)).text();

likes[i] = /"likes":(\d+)/.exec(html)[1];
}
}
return likes;
}
Insert cell
Insert cell
Insert cell
(await fetchp(metadata[147].url)).text()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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