Case study · Web scraping + EDA

Goodreads Scraping & Analysis

There was no ready-made dataset, so I built one. A Selenium scraper visited 3,642 Goodreads book pages, every book on the "Best Books of 2020" list plus Neil Gaiman's full catalogue, and pulled 11 fields from each. Then I tested what actually goes with a high rating: genre, popularity, length, or how many people are reading it.

3,642book pages scraped
11fields collected per book
81genres compared on the 2020 list
r = 0.80readers right now vs. number of ratings
01Question

Two angles on what makes a book well rated. Across one year's best books: do some genres score higher, and do popular books score better? Across one author's whole catalogue: does a book's length, the author's age, its language, or current interest line up with its rating? None of this exists as a download, so the first job was collecting it.

02Approach
CollectBook linksWalk all 16 pages of the 2020 list and 21 pages of the author list, then de-duplicate
VisitEach book pageSelenium opens every book and reads 11 fields
SurviveChanging layoutsFallback XPaths in try/except, since fields move between pages
RevealHidden detailsClick "Book details" with ActionChains to read the language
CleanPandasStrip commas, expand "47.1k", handle missing values, derive author age

the fallback idea, condensed from the notebook ↓

# the genre sits in a different <div> depending on the book, so try each layout in turn
def getGenre():
    for n in (6, 5, 4, 7, 8):
        try:
            return driver.find_element('xpath', f'//*[@id="__next"]/…/div[2]/div[{n}]/ul/span[1]/span[2]/a/span').text
        except:
            continue
    return None
03Best of 2020

One year's best books

1,542 books from Goodreads' "Best Books of 2020" list, with an average rating of 4.01 and almost 50 million ratings between them.

Average rating by genre

Genres with at least 10 books, plus the four biggest.

Urban Fantasy4.32
Christian Fiction4.29
Picture Books4.27
History4.15
Nonfiction (142)4.08
Fantasy (178)4.02
Romance (295)3.98
Fiction (190)3.78

Bars start at 3.5. Self Help, Nature and Time Travel topped the raw table (4.54–4.64), but each had just one book.

Lowest rating at each popularity level

The average barely moves, but the floor rises.

< 10K ratings2.78
10K – 100K2.66
100K – 500K3.16
500K+ ratings3.64

Bars run from 2.5 to 4.5. Average ratings in the four bands: 4.01, 3.99, 4.02, 4.09 (938, 497, 90 and 16 books).

Niche genres score highest

Smaller genres like Urban Fantasy, Christian Fiction and Picture Books beat the big ones. General Fiction, the second-largest genre, had the lowest average at 3.78.

Popular doesn't mean better rated

The number of ratings and the average rating are essentially unrelated (r ≈ 0.02). But no book with more than 200K ratings scored below 3.5, so heavy readership rules out a flop rather than guaranteeing a hit.

The most-rated book of 2020

The Midnight Library had 2.03 million ratings at a 3.99 average, ahead of Beach Read (1.34M) and The Invisible Life of Addie LaRue (1.23M).

04Neil Gaiman

One author's whole catalogue

2,100 entries from Neil Gaiman's Goodreads author page, across every edition and translation.

Editions by language

67% of the editions with a known language are in English.

English1,294
Spanish118
Italian85
Portuguese62
French45
German23
Russian23
Polish22

178 entries had no language listed.

Average rating by edition length

Length barely matters, except for the longest editions.

< 100 pages4.00
100 – 3003.98
300 – 6004.01
600+ pages4.20

Bars start at 3.5. 492, 367, 276 and 75 editions with both a page count and a rating.

Interest drives the number of ratings, not the score

Books more people are reading right now collect far more ratings (r = 0.80), but their average rating stays at about 4.0 whether a handful or tens of thousands of people are reading.

Length doesn't follow his age

Working out his age at each publication (born 1960) showed no real trend in page count (r ≈ 0.04 across 1,078 dated editions).

Language doesn't change the picture

Rating patterns looked the same for English-only editions and for all editions together.

A Goodreads quirk worth knowing

An author page lists everything the author is credited on. Only 1,346 of the 2,100 entries name Gaiman as the main author; the rest are anthologies and books he contributed to (Dune and Fahrenheit 451 both appear).

05Notebook

Charts from the notebook

The original Matplotlib output behind the findings above.