Skip to main content
100%

How to use The Guardian's API to download article data for content analysis (in Python 3.x)

✓ Published0🌍 Public
GGeorgeMcIntire
Last edited Mar 7, 2016
Created on Mar 8, 2016

This example demonstrates how to perform content analysis on Guardian news articles by programmatically downloading article data through The Guardian’s open API. It shows the entire workflow, from constructing API queries with parameters like `from-date`, `to-date`, and `show-fields`, to parsing the returned JSON metadata and article bodies. The Python script uses the `requests` library to fetch paginated results into day-sized chunks, saving the raw JSON files locally for further analysis. The example also highlights the API’s response structure, including fields such as `wordcount`, `byline`, and full article HTML.

AI-generated description

Similar vizzes