Skip to main content

Nobel Prize headlines and API - 02/03/2023

🍩 Let’s use crul to extract headlines from nobelprize.org.

/* Open the nobelprize webpage */
open https://www.nobelprize.org/
/* filter for elements containing the string "headline" in the "parentElement.attributes.class" column */
|| contains parentElement.attributes.class headline

🍩 Now onto the API. Here’s a query that will get us a full list of all Nobel Laureates since the award’s inception.

/* make an initial api request to the nobelprize api */
api get https://api.nobelprize.org/2.1/laureates
/* build a range of values for pagination using the "meta.count" value as our max */
|| range 0 $meta.count$ page --step 25
/* expanding request for laureates using the page column to determine the offset*/
|| api get https://api.nobelprize.org/2.1/laureates?offset=$page$
/* results are in an array, expand the laureates array column into row per array entry*/
|| normalize laureates

Try adding || countOf birth.place.country.en to the end of the query to get a count of laureates by country of birth. Then use the attributes modal to find the column name of the birth city and get a count of laureates by city of birth.