> ## Content Index
> Fetch the complete content index at: https://serpapi.com/blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Scrape Barnes & Noble Search Results
- URL: https://serpapi.com/blog/how-to-scrape-barnes-and-noble-search-results/
- Published: 2026-12-04T15:26:18.000Z
- Updated: 2026-12-04T15:34:25.000Z
- Description: Gather books, eBooks, audiobooks, vinyl, and toys listed by Barnes and Noble with one simple API call. In this article we will cover sorting, filtering, pagination, and saving the bookstore's results to CSV.
- Author: Audrey Kendrick
- Tags: Barnes and Noble

Barnes & Noble lists books, eBooks, audiobooks, vinyl, toys, and more, each with prices, formats, badges, and a sales rank. The [Barnes & Noble API](https://serpapi.com/barnes-and-noble-api) from SerpApi turns a Barnes & Noble search into structured data, so you can compare editions, track prices, or build a reading-list tool without parsing a web page yourself.

In this tutorial, we'll look at what the API returns, try it in the Playground, and call it with a plain GET request, cURL, Python, and JavaScript. Then we'll cover sorting, filtering, pagination, and saving results to CSV. We'll use the search the book title `dune` throughout.

![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/2026/11/bn_playground.png)

## What can you scrape from Barnes & Noble?

A search returns its products in `organic_results`. Each result can include:

- **Product basics:** `title`, `link`, `thumbnail`, and `description`
- **Identifiers:** `ean` (the ISBN-13 for books) and `work_id`, which is shared across formats of the same work
- **Contributors:** a `contributors` array with each person's `name`, `role` (for example Author, Illustrator, or Narrated by), and `link`
- **Format details:** `format` (such as Paperback, Hardcover, eBook, Audiobook, or Vinyl LP), `edition`, `series`, and `series_number`
- **Pricing:** `price` and `old_price`, both in USD
- **Promotions and stock:** `badges` (for example Bestseller or Signed Edition) and `out_of_stock`
- **Popularity and dates:** `sales_rank`, where a lower number means a better-selling product, and `publication_time_iso8601`

Not every field appears on every result. `old_price` and `badges` show up on discounted or promoted products, and `edition` and `series` show up when they apply.

Beyond the products, the response also includes:

- **`search_information`:** `total_results`, `query_displayed`, `spelling_fix`, and `organic_results_state`
- **`filters`:** the filter options Barnes & Noble offers for your search, each with a `parameter` name you can send back in your next request
- **`serpapi_pagination`:** `current`, `next_page_token`, and `next`

## Getting started with SerpApi

The fastest way to try the API is the [Barnes & Noble Playground](https://serpapi.com/playground?engine=barnes%5Fand%5Fnoble). Type `dune` as the search query and run it to see the JSON before writing any code.

To call the API from your own code, you need an API key. [Sign up for a SerpApi account](https://serpapi.com/users/sign%5Fup), then sign in to your [dashboard](https://serpapi.com/dashboard) to find your key. Treat it like a password and keep it out of your code and repositories.

Store it in an environment variable so the examples below can read it:

```bash
export SERPAPI_API_KEY="YOUR_SERPAPI_API_KEY"

```

Replace `YOUR_SERPAPI_API_KEY` with your own key. In a terminal, this lasts only for the current session.

## How to scrape Barnes & Noble search results

The Barnes & Noble API uses `engine=barnes_and_noble`. These are the parameters we'll use most:

- `**engine**` (required): Set to `barnes_and_noble`
- **`q`** (required): Your search text (A title, author, keyword, or ISBN all work.)
- **`api_key`** (required): Your SerpApi private API key
- `**sort_by**` (optional): Defaults to Top Matches, other values include `bestsellers`, `newest`, `oldest`, `price_low_to_high`, `price_high_to_low`, and `title`
- `**product_format**` (optional): Filters by format, such as `Hardcover` or `Paperback`
- **`next_page_token`** (optional): Leave it out for page 1\. Use the token from the previous response to get the next page.

### GET request

The basic request is a GET to `https://serpapi.com/search.json`. JSON is the default output.

Here is an example call:

```
https://serpapi.com/search.json?engine=barnes_and_noble&q=dune&api_key=YOUR_SERPAPI_API_KEY

```

This is the shape of the response with values left out. Your real response will have actual data.

```json
{
  "search_metadata": {
    "id": "...",
    "status": "Success"
  },
  "search_information": {
    "total_results": 0,
    "query_displayed": "...",
    "organic_results_state": "..."
  },
  "organic_results": [
    {
      "position": 1,
      "title": "...",
      "link": "...",
      "ean": "...",
      "work_id": "...",
      "contributors": [
        {
          "name": "...",
          "role": "Author",
          "link": "..."
        }
      ],
      "format": "...",
      "publication_time_iso8601": "...",
      "price": 0.0,
      "sales_rank": 0,
      "thumbnail": "...",
      "description": "..."
    }
  ],
  "filters": [
    {
      "title": "...",
      "parameter": "...",
      "options": [
        {
          "text": "...",
          "value": "...",
          "count": 0,
          "serpapi_link": "..."
        }
      ]
    }
  ],
  "serpapi_pagination": {
    "current": 1,
    "next_page_token": "...",
    "next": "..."
  }
}

```

A few things to keep in mind:

- `search_metadata.status` moves from `Processing` to `Success` or `Error`. If a search fails, `search_metadata.error` holds the message. See [status and error codes](https://serpapi.com/api-status-and-error-codes) for more.
- `publication_time_iso8601` is midnight Eastern Time on the publication date, expressed in UTC. A book published on a given day can look like the evening before if you only read the UTC date.
- If Barnes & Noble corrected a misspelled query, `search_information.spelling_fix` holds the query it searched instead, and `organic_results_state` explains what happened. For example, it can say "Showing results for fixed spelling" or "Fully empty".

### Markdown output

If you want results that are easy to read, or you're sending them to an LLM, add `output=md`:

```
https://serpapi.com/search?engine=barnes_and_noble&q=dune&output=md&api_key=YOUR_SERPAPI_API_KEY

```

Markdown trims some data to stay compact, such as tracking fields, redirect URLs, nested details, and filter sections. When you need exact field access, like reading `contributors[].name` or the pagination token in code, use JSON. All of the code below uses JSON.

### cURL

This cURL command is another way to request thisendpoint and parameters. `--get` with `--data-urlencode` takes care of URL encoding:

```bash
curl --get "https://serpapi.com/search.json" \
  --data-urlencode "engine=barnes_and_noble" \
  --data-urlencode "q=dune" \
  --data-urlencode "api_key=$SERPAPI_API_KEY"

```

Results should look like: 

![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/2026/11/bn_curl.png)

The cURL call results for the Barnes and Noble API

### Python

SerpApi also has an official Python library. See the [Python integration page](https://serpapi.com/integrations/python) for more. Install it with:

```bash
pip install serpapi

```

Create a file named `main.py`, and add the code below:

```python
import os
import serpapi

client = serpapi.Client(api_key=os.environ["SERPAPI_API_KEY"], timeout=60)

results = client.search({
    "engine": "barnes_and_noble",
    "q": "dune",
})

if "error" in results:
    raise SystemExit("The search failed. Check your API key and parameters.")

products = results.get("organic_results", [])
if not products:
    print("No products found.")

for product in products:
    authors = ", ".join(
        c["name"] for c in product.get("contributors", []) if c.get("role") == "Author"
    )
    price = product.get("price")
    print(f'{product["position"]}. {product["title"]} ({product.get("format", "n/a")})')
    print(f'   Author: {authors or "Unknown"} | Price: {f"${price:.2f}" if price is not None else "n/a"}')
    print(f'   {product["link"]}')

```

Run it with:

```bash
python main.py

```

A few notes on the code:

- `os.environ["SERPAPI_API_KEY"]` raises an error if the variable isn't set, so you'll know right away if the key is missing.
- A request can succeed over HTTP and still return an `error` field in the body, so the code checks for it before reading results.
- It prints only a few fields per product. The response has more, so print or save whatever your project needs.

Results should look like:

![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/2026/12/_bn_py_.png)

The B&N Python Results

For production code, you may want to catch the library's documented exceptions, including `serpapi.HTTPError`, `serpapi.HTTPConnectionError`, and `serpapi.TimeoutError`.

### JavaScript

SerpApi also has an official [JavaScript library](https://github.com/serpapi/serpapi-javascript/). Install it with:

```bash
npm install serpapi

```

Create a file named `main.js` and add in this code below:

```javascript
async function main() {
  const { getJson } = await import("serpapi");

  const apiKey = process.env.SERPAPI_API_KEY;
  if (!apiKey) {
    console.error("Set the SERPAPI_API_KEY environment variable first.");
    process.exit(1);
  }

  try {
    const results = await getJson({
      engine: "barnes_and_noble",
      api_key: apiKey,
      q: "dune",
    });

    if (results.error) {
      console.error("The search failed. Check your API key and parameters.");
      process.exit(1);
    }

    const products = results.organic_results ?? [];
    if (products.length === 0) {
      console.log("No products found.");
      return;
    }

    for (const product of products) {
      const authors =
        (product.contributors ?? [])
          .filter((c) => c.role === "Author")
          .map((c) => c.name)
          .join(", ") || "Unknown";
      const price =
        product.price != null ? `$${product.price.toFixed(2)}` : "n/a";
      console.log(`${product.position}. ${product.title} (${product.format ?? "n/a"})`);
      console.log(`   Author: ${authors} | Price: ${price}`);
      console.log(`   ${product.link}`);
    }
  } catch (error) {
    console.error(`Request failed: ${error.message}`);
    process.exit(1);
  }
}

main();

```

Run it with:

```bash
node main.js

```

The results should look like:

![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/2026/12/_bn_js_.png)

The B&N JavaScript Results

### Other languages and no-code tools

SerpApi has libraries for other languages too, including Ruby, Go, PHP, Java, Rust, and .NET. Check the [integrations page](https://serpapi.com/integrations) for the full list.

For no-code tools, SerpApi has an app for [Make](https://serpapi.com/blog/announcing-serpapis-make-app/) and a verified node for [n8n](https://serpapi.com/blog/boost-your-n8n-workflows-with-serpapis-verified-node/). Check each announcement for which APIs its native modules cover. 

## How to sort results

By default, results come back as Top Matches. Use `sort_by` to change the order:

- `bestsellers`
- `newest`
- `oldest`
- `price_low_to_high`
- `price_high_to_low`
- `title`

This request returns the best-selling `dune` results first:

```
https://serpapi.com/search.json?engine=barnes_and_noble&q=dune&sort_by=bestsellers&api_key=YOUR_SERPAPI_API_KEY

```

In Python, reuse the client and add the parameter:

```python
results = client.search({
    "engine": "barnes_and_noble",
    "q": "dune",
    "sort_by": "bestsellers",
})

```

Each product also has a `sales_rank`, so you can see the ranking for yourself. For more on sorting, see the [Barnes & Noble sorting documentation](https://serpapi.com/barnes-and-noble-sorting).

## How to filter results

The `filters` array in the response tells you what you can filter by for your search. Each entry has a `title`, the request `parameter` name, and a list of `options`, and each option has a `text`, a `value`, a `count`, and a ready-made `serpapi_link`.

You can list them in Python:

```python
results = client.search({
    "engine": "barnes_and_noble",
    "q": "dune",
})

for group in results.get("filters", []):
    print(group["title"], f'(parameter: {group["parameter"]})')
    for option in group.get("options", []):
        print(f'   {option["text"]} ({option["count"]})')

```

The available request filters include:

- `**availability**`: `in_stock` or `pre_order`.
- **`department`**, **`subject`**, **`product_format`**, **`age`**, **`price`**, **`language`**, and `**color**`: the values come from the `filters` in the response.
- `**rating**`: a minimum average rating, from `1` to `5`.

To pass more than one value to a filter, separate them with `||`. This request searches `dune`, sorted by bestsellers, and keeps only hardcovers and paperbacks. The `||` is URL-encoded as `%7C%7C`:

```
https://serpapi.com/search.json?engine=barnes_and_noble&q=dune&sort_by=bestsellers&product_format=Hardcover%7C%7CPaperback&api_key=YOUR_SERPAPI_API_KEY

```

In Python, write the value with `||` and the library handles the encoding:

```python
results = client.search({
    "engine": "barnes_and_noble",
    "q": "dune",
    "sort_by": "bestsellers",
    "product_format": "Hardcover||Paperback",
})

```

Filter values come from the response, so copy them from `filters` instead of guessing. Filtering a search is also a good way to narrow down results by price, format, or rating before you read them in code. For more detail, see the [Barnes & Noble filtering documentation](https://serpapi.com/barnes-and-noble-filtering).

## How to paginate

The API returns up to 24 results per page. It uses a token instead of a page number. Leave `next_page_token` out for page 1\. The response then gives you the token for the next page at `serpapi_pagination.next_page_token`, and you send it back with the same parameters as the original search.

```
https://serpapi.com/search.json?engine=barnes_and_noble&q=dune&next_page_token=YOUR_NEXT_PAGE_TOKEN&api_key=YOUR_SERPAPI_API_KEY

```

In Python, reuse the client and the parameters, and add the token on each turn:

```python
params = {
    "engine": "barnes_and_noble",
    "q": "dune",
}

for _ in range(3):
    page = client.search(params)

    if "error" in page:
        raise SystemExit("The search failed. Check your API key and parameters.")

    for product in page.get("organic_results", []):
        print(product["title"])

    token = page.get("serpapi_pagination", {}).get("next_page_token")
    if not token:
        break

    params["next_page_token"] = token

```

This fetches up to three pages. A few important points to consider:

- The token expires 15 minutes after the original search.
- Expired tokens still work up to page 5, but more slowly.
- For pages beyond 5 after the token expires, run the search again from page 1 with `no_cache` set to `true`.

The JavaScript library says built-in pagination isn't supported, so in JavaScript you'd do the same by hand: await `getJson` for each page and pass the token from the previous response. See the [Barnes & Noble pagination documentation](https://serpapi.com/barnes-and-noble-pagination) for more.

## How to save results to CSV

Products are repeated records with the same fields, so they fit nicely into CSV rows. This script uses Python's standard library and writes UTF-8\. It flattens `contributors` into one cell, written as `Name (Role)` and joined with `; `:

```python
import csv
import os
import serpapi

client = serpapi.Client(api_key=os.environ["SERPAPI_API_KEY"], timeout=60)

results = client.search({
    "engine": "barnes_and_noble",
    "q": "dune",
    "sort_by": "bestsellers",
})

if "error" in results:
    raise SystemExit("The search failed. Check your API key and parameters.")

fields = ["position", "title", "contributors", "format", "price", "ean", "link"]

with open("products.csv", "w", newline="", encoding="utf-8") as file:
    writer = csv.DictWriter(file, fieldnames=fields)
    writer.writeheader()

    for product in results.get("organic_results", []):
        writer.writerow({
            "position": product.get("position"),
            "title": product.get("title"),
            "contributors": "; ".join(
                f'{c["name"]} ({c.get("role", "n/a")})'
                for c in product.get("contributors", [])
            ),
            "format": product.get("format"),
            "price": product.get("price"),
            "ean": product.get("ean"),
            "link": product.get("link"),
        })

print("Saved products.csv")

```

Save `ean` as text. Spreadsheet programs can turn a long ISBN into a number and drop leading zeros or switch to scientific notation, so format that column as text when you open the file.

## Conclusion

The Barnes & Noble API gives you product search results with prices, formats, contributors, and sales rank as structured data. You've seen how to call it with GET, cURL, Python, and JavaScript, and how to sort, filter with the `filters` the response returns, and page through results with `next_page_token`.

For the full parameter list and response details, see the [Barnes & Noble API documentation](https://serpapi.com/barnes-and-noble-api). You can also read the [release notes](https://serpapi.com/barnes-and-noble-api/release-notes) and try your own searches in the [Playground](https://serpapi.com/playground?engine=barnes%5Fand%5Fnoble).

If you're working with book data, these are separate SerpApi APIs, each with its own parameters and response:

- [Google Books API](https://serpapi.com/google-books-api) for Google Books search results.
- [Google Play Books API](https://serpapi.com/google-play-books) for Google Play's book listings.

Here are other relevant tutorials for above:

[How to Scrape Google Books ResultsThe Google Books API from SerpApi returns search results as structured data, so you can work with titles, authors, publication dates, preview links, and matching snippets in your code.![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/icon/serpapi-favicon-891721ad-775a-496b-a435-bcd4247a5449.png)SerpApiAudrey Kendrick![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/thumbnail/google_books_header-aed86bcd-fa03-42fe-9916-2b20fca8a4cc.jpg)](https://serpapi.com/blog/how-to-scrape-google-books-results/)

[How to scrape book results from the Google Play StoreSearch for books, check top lists, and fetch book home pages on the Google Play Store using SerpApi, with results in simple JSON format.![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/icon/serpapi-favicon-dbf4b8ab-3ea8-41b5-9ebb-97fdb7a68d14.png)SerpApiCorbin Davenport![](https://storage.ghost.io/c/a5/00/a5004977-0dd2-4bcd-9292-dd0e05d4c59e/content/images/thumbnail/books-3-2d83defe-794c-4dfa-aa05-9ea48179ea58.jpg)](https://serpapi.com/blog/how-to-scrape-google-play-books-results/)