# Kitapyurdu Price Scraper — book prices, discounts & stock (`retrolabstudio/kitapyurdu-price-scraper`) Actor

Scrape public Kitapyurdu.com search, category, publisher and author listing pages: title, author, publisher, list price, discounted price, discount %, stock status, page count and URL for every book. robots.txt-compliant, no login.

- **URL**: https://apify.com/retrolabstudio/kitapyurdu-price-scraper.md
- **Developed by:** [Furkan Yalçıntaş](https://apify.com/retrolabstudio) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Kitapyurdu Price Scraper — book prices, discounts & stock

Track **book prices, discounts and stock on Kitapyurdu.com**, one of Turkey's largest online bookstores.
Give the Actor search terms (titles, authors, ISBNs, keywords) and/or Kitapyurdu category, publisher or
author pages, and get one clean table of books with the current selling price, list price, discount %,
stock status, publisher, page count and URL.

Built for publishers, booksellers, price-comparison sites and researchers who want to answer questions like:

- What does Kitapyurdu currently charge for our titles, and how big is the discount?
- Which books in a category or from a competing publisher are on sale this week?
- Which titles are shipped from Kitapyurdu's own stock, which come from the publisher, which are not sold?

**Robots-compliant:** only public listing pages are read (the site's own search listing, category,
publisher and author pages). Each URL is checked against Kitapyurdu's live robots.txt before it is
requested; a disallowed URL is skipped and reported. No login, no account pages, no checkout.

### What it extracts

One dataset row per book, in the order Kitapyurdu lists them:

| Field | Description |
|---|---|
| `input`, `inputType` | the search term or start URL that produced the row; `search` or `url` |
| `rank` | 1-based position within that input (after de-duplication) |
| `title` | book title |
| `url`, `productId` | canonical product URL and Kitapyurdu product id |
| `author` | author(s), comma-separated |
| `publisher` | publisher name |
| `price` | current Kitapyurdu selling price |
| `listPrice` | publisher's list price |
| `discountPercent` | discount of `price` against `listPrice`, rounded to a whole percent |
| `currency` | always `TRY` |
| `inStock`, `stockStatus` | `in_stock` (ships from Kitapyurdu), `supplier` (supplied by the publisher, longer shipping), `not_sold` (listed but not for sale) |
| `publishDate`, `pageCount`, `language`, `binding` | catalogue details shown on the listing card |
| `ratingStars` | 0-5 stars shown on the card |
| `imageUrl` | cover image |
| `page`, `scrapedAt` | listing page number and UTC timestamp |

A `RUN_SUMMARY` record in the key-value store lists pages, items and duplicates per input, HTTP status
counts, blocked requests and any warnings.

### Input

| Field | Default | Notes |
|---|---|---|
| `searchTerms` | — | titles, authors, ISBNs or keywords, as typed into Kitapyurdu search |
| `startUrls` | — | category (`/kategori/...`), publisher (`/yayinevi/...`) or author (`/yazar/...`) pages; other URLs are skipped with a warning |
| `maxItemsPerInput` | `100` | unique books per search term / start URL (1-5000) |
| `maxPages` | `5` | hard cap on listing pages per search term / start URL (1-250); Kitapyurdu shows 20 books per page |
| `proxyConfiguration` | Apify residential, Turkey | Kitapyurdu blocks datacenter IPs; proxy traffic is included in the price |

At least one search term or start URL is required; at most 50 inputs per run.

Example:

```json
{
  "searchTerms": ["sabahattin ali", "yapay zeka"],
  "startUrls": [{ "url": "https://www.kitapyurdu.com/kategori/kitap-edebiyat/128.html" }],
  "maxItemsPerInput": 40,
  "maxPages": 5
}
```

### Output example

Real rows from a local run on 2026-10-13 (120 books from the input above):

```json
[
  {
    "input": "https://www.kitapyurdu.com/kategori/kitap-edebiyat/128.html",
    "inputType": "url",
    "rank": 1,
    "title": "Roma'nın Beş Günü",
    "url": "https://www.kitapyurdu.com/kitap/romanin-bes-gunu/767268.html",
    "productId": "767268",
    "author": "Ahmet Ümit",
    "publisher": "YAPI KREDİ YAYINLARI",
    "price": 350.0,
    "listPrice": 500.0,
    "discountPercent": 30,
    "currency": "TRY",
    "inStock": true,
    "stockStatus": "in_stock",
    "publishDate": "01.10.2026",
    "pageCount": 512,
    "language": "TÜRKÇE",
    "binding": "Karton Kapak",
    "ratingStars": 5,
    "imageUrl": "https://img.kitapyurdu.com/v1/getImage/fn:12291630/wi:200/wh:fd7299f1f",
    "page": 1,
    "scrapedAt": "2026-10-13T17:18:03Z"
  },
  {
    "input": "sabahattin ali",
    "inputType": "search",
    "rank": 2,
    "title": "Sabahattin Ali",
    "url": "https://www.kitapyurdu.com/kitap/sabahattin-ali/656250.html",
    "productId": "656250",
    "author": "Abdullah Yılmaz",
    "publisher": "SİDAR YAYINLARI",
    "price": 165.0,
    "listPrice": 240.0,
    "discountPercent": 31,
    "currency": "TRY",
    "inStock": true,
    "stockStatus": "supplier",
    "publishDate": "01.01.2023",
    "pageCount": 240,
    "language": "TÜRKÇE",
    "binding": null,
    "ratingStars": 0,
    "imageUrl": "https://img.kitapyurdu.com/v1/getImage/fn:11754051/wi:200/wh:fbd9c1819",
    "page": 1,
    "scrapedAt": "2026-10-13T17:17:53Z"
  }
]
```

The dataset has two views: **Books** (overview) and **Price tracking** (compact price / stock table).
Export as JSON, CSV, Excel or via the API.

### Pricing

Pay per event: **$0.002 per book** saved to the dataset (`product-scraped`, i.e. $2 per 1,000 books) plus
Apify's standard Actor start event. A run of 3 inputs x 40 books costs about $0.24. See the Pricing tab for
the current prices. Set a maximum cost per run in the run options and the Actor stops cleanly when it is
reached; you are only charged for books actually saved.

### Limits and good to know

- Only **public listing pages** are read, and only URLs that robots.txt allows. No product-detail pages,
  no login, no account pages, no checkout.
- **No personal data** is collected: no customer reviews, reviewer names, e-mails or phone numbers — only
  catalogue data.
- Requests are sequential with a 1-2 second pause between pages and exponential backoff on HTTP 403/429/5xx.
  After 3 failed or blocked pages in a row the run stops and a warning is shown in the run status.
- Fields come from the listing card, so a few can be empty when Kitapyurdu does not show them (for example
  `binding` or `author` on some books).
- Prices are the ones Kitapyurdu shows publicly at scrape time, in Turkish lira; campaign prices that need
  a login or a basket are not visible.
- If Kitapyurdu changes its page layout and nothing can be parsed, the run status says
  `0 books parsed — selector may be outdated (or no results)`. Please open an issue so the parser can be updated.

### Legal

This Actor only accesses publicly available pages, at a modest request rate, and does not collect personal
data. You are responsible for using the data in line with Kitapyurdu's terms and applicable law.

**Not affiliated with, endorsed by or sponsored by Kitapyurdu.** Kitapyurdu is a trademark of its owner.

### Run locally and deploy

```bash
pip install -r requirements.txt
python -m unittest discover -s tests -t .       # offline tests (HTML fixtures)
APIFY_LIVE=1 python -m unittest tests.test_live  # optional live check
./local_run.sh '{"searchTerms": ["sabahattin ali"], "maxItemsPerInput": 20}'   # apify run + copies results to cikti/
apify login          # once; paste your API token from Console > Settings > API & Integrations
apify push           # builds the Docker image on the Apify platform
```

`.actor/pay_per_event.json` is **not** read by the Apify platform. It only feeds the local pay-per-event
simulation in `local_run.sh` (`ACTOR_TEST_PAY_PER_EVENT`). The real event prices are entered in Apify Console
(Publication > Monetization > Pay per event) and must match the event names used in `src/main.py`.

# Actor input Schema

## `searchTerms` (type: `array`):

Book titles, authors, ISBNs or keywords, exactly as you would type them into Kitapyurdu search, e.g. 'sabahattin ali'.

## `startUrls` (type: `array`):

Kitapyurdu listing pages, e.g. https://www.kitapyurdu.com/kategori/kitap-edebiyat/128.html, a /yayinevi/... publisher page or a /yazar/... author page. Other URLs are skipped with a warning.

## `maxItemsPerInput` (type: `integer`):

Stop after this many unique books for each search term or start URL (Kitapyurdu shows 20 books per page).

## `maxPages` (type: `integer`):

Hard cap on listing pages requested for each search term or start URL.

## `proxyConfiguration` (type: `object`):

Residential proxy in Turkey by default: Kitapyurdu blocks datacenter IPs. Proxy traffic is included in the price; change only if you bring your own proxies.

## Actor input object example

```json
{
  "searchTerms": [
    "sabahattin ali"
  ],
  "startUrls": [
    {
      "url": "https://www.kitapyurdu.com/kategori/kitap-edebiyat/128.html"
    }
  ],
  "maxItemsPerInput": 100,
  "maxPages": 5,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "TR"
  }
}
```

# Actor output Schema

## `books` (type: `string`):

All scraped books (overview view).

## `prices` (type: `string`):

Compact price / stock view.

## `runSummary` (type: `string`):

Books and pages per input, blocked requests and warnings.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchTerms": [
        "sabahattin ali"
    ],
    "startUrls": [
        {
            "url": "https://www.kitapyurdu.com/kategori/kitap-edebiyat/128.html"
        }
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "TR"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("retrolabstudio/kitapyurdu-price-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchTerms": ["sabahattin ali"],
    "startUrls": [{ "url": "https://www.kitapyurdu.com/kategori/kitap-edebiyat/128.html" }],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "TR",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("retrolabstudio/kitapyurdu-price-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchTerms": [
    "sabahattin ali"
  ],
  "startUrls": [
    {
      "url": "https://www.kitapyurdu.com/kategori/kitap-edebiyat/128.html"
    }
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "TR"
  }
}' |
apify call retrolabstudio/kitapyurdu-price-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,retrolabstudio/kitapyurdu-price-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/gbSNowFffr7DUzFg2/builds/75CpZqowFczJJpdja/openapi.json
