{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Create a Trove OCR corrections ticker" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Run this cell first to set things up\n", "import requests\n", "import time\n", "from IPython.display import display, HTML, clear_output\n", "params = {\n", " 'q': 'has:corrections',\n", " 'zone': 'newspaper',\n", " 'encoding': 'json',\n", " 'n': '0',\n", " 'key': 'ju3rgk0jp354ikmh'\n", "}\n", "\n", "def update_corrections():\n", " try:\n", " while True:\n", " clear_output(wait=True)\n", " response = requests.get('http://api.trove.nla.gov.au/v2/result', params=params)\n", " data = response.json()\n", " total = int(data['response']['zone'][0]['records']['total'])\n", " display(HTML('
Trove users have made corrections to {:,} newspaper articles.
'.format(total)))\n", " time.sleep(5)\n", " except KeyboardInterrupt:\n", " pass" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "Trove users have made corrections to 11,998,162 newspaper articles.
" ], "text/plain": [ "