Public
Edited
Aug 30, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
table(
bestseller_data.results.books.map(
({
rank,
weeks_on_list,
title,
author,
publisher,
book_image,
description,
buylinks
}) => ({
Rank: md`**${rank}**`,

" ": html`<img width=200 src="${book_image}" />`,

Title: html`<h2 style="text-align:center;">${title}</h2>`,
Author: md`${author}`,
Publisher: md`${publisher}`,
"Weeks On List": md`${weeks_on_list} week(s) on list`,

Description: html`<p style="text-align:center;">${description}</p>`
})
)
)
Insert cell
/*viewof table1 = Inputs.table(bestseller_data.results.books, {
format: {
book_image: (x) => html`<img width=150px src="${x}" />`,
description: (x) => html`<p style="text-align:center;">${x}</p>`,
weeks_on_list: (x) => md`${x} week(s) on list`
},
columns: [
"rank",
"book_image",
"title",
"author",
"publisher",
"weeks_on_list",
"description"
],
header: {
rank: "Rank",
title: "Title",
author: "Author",
publisher: "Publisher",
weeks_on_list: "Weeks On List",
description: "Description",
book_image: " "
},
width: {
description: 400,
rank: 40,
weeks_on_list: 40
},
maxWidth: 1000,
maxHeight: 1000,
layout: "fixed"
})*/
Insert cell
bestseller_isbns = bestseller_data.results.books.map(d => d.primary_isbn10)
Insert cell
bestseller_data = await fetchp(
`https://api.nytimes.com/svc/books/v3/lists/${format(
date
)}/${list_genre}.json?api-key=${my_api_key}`,
{
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
}
).then((response) => {
return response.json();
})
Insert cell
Insert cell
_ = require('lodash')
Insert cell
Insert cell
import { fetchp } from "@tomlarkworthy/fetchp"
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
format = d3.timeFormat("%Y-%m-%d")
Insert cell
my_api_key = "PVvQcv5ov1V9fy6cLAdJAUAo9cymw38a"
Insert cell
todays_date = {
let date = new Date();
return format(date);
}
Insert cell
import { Table, Search } from "@observablehq/inputs"
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