# Skroutz.gr Product Scraper v2 (`mpelas/mpelas-myactor-skroutz-v2`) Actor

Scrapes products from Skroutz.gr search/category pages via Playwright, captures the variations.json XHR payload, follows pagination, deduplicates products, and computes per-search-query price statistics. Pay-per-event: $0.005 per scraped product.

- **URL**: https://apify.com/mpelas/mpelas-myactor-skroutz-v2.md
- **Developed by:** [mpelas](https://apify.com/mpelas) (community)
- **Categories:** E-commerce
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $70.00 / 1,000 product scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## Skroutz.gr Product Scraper v2 (Apify Actor, Python + Crawlee/Playwright)

Enhanced version of `mpelas-myactor-Skroutz`. Scrapes product listings from
[Skroutz.gr](https://www.skroutz.gr) search and category pages.

### How it works

1. Opens each start URL in a headless Chromium (Playwright) with stealth flags,
   Greek locale/timezone and realistic headers.
2. Dismisses the cookie banner, scrolls to trigger the lazy `variations.json`
   XHR, and captures it via a response listener.
3. Fallbacks if the XHR is not captured: an in-page `fetch()` of
   `/s/variations.json?sku_ids=...` using SKU ids read from the DOM, then direct
   DOM extraction of product cards.
4. Deduplicates products by `sku_id` across all pages, follows pagination
   (`?page=N`) up to `max_pages_per_url`, and pushes each product to the dataset.
5. After the crawl, computes per-search-query statistics (count, min, max,
   mean, median, std dev, cheapest and best-rated product) and stores them in
   the key-value store as `category_statistics`, plus a `run_summary` record.

### Input

```json
{
  "start_urls": [{"url": "https://www.skroutz.gr/search?keyphrase=lenovo+laptop"}],
  "max_requests_per_crawl": 20,
  "max_pages_per_url": 1,
  "max_concurrency": 2,
  "request_timeout_seconds": 60,
  "max_retries": 3,
  "proxy_configuration": {"useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"]},
  "save_debug_screenshots": false
}
```

| Field | Default | Description |
|---|---|---|
| `start_urls` | (required) | Skroutz search/category URLs |
| `max_requests_per_crawl` | 20 | Total page limit across all URLs |
| `max_pages_per_url` | 1 | Pagination depth per start URL |
| `max_concurrency` | 2 | Parallel browser pages (1-5) |
| `request_timeout_seconds` | 60 | Navigation/handler timeout |
| `max_retries` | 3 | Retries per failed page |
| `proxy_configuration` | off | Apify Proxy / custom proxies (recommended for Skroutz) |
| `save_debug_screenshots` | false | Save PNGs to KVS `debug/` on failures |

### Output

- **Dataset** (view `overview`): one item per product — `sku_id`, `name`,
  `price`, `price_eur`, `currency`, `url`, `image_url`, `variation_image`,
  `variation_color`, `follow`, `rating`, `rating_count`, `search_query`,
  `page_type`, `page_number`, `page_url`, `page_title`, `scraped_at`.
- **Key-value store**: `category_statistics` (per-query stats),
  `run_summary` (run metadata), `debug/` screenshots if enabled.

### Pricing (pay per event)

The Actor uses Apify's pay-per-event model:

| Event | Price |
|---|---|
| `product_scraped` (primary) | $0.005 FREE tier, $0.004 BRONZE, $0.003 SILVER, $0.0025 GOLD per product |
| `apify-actor-start` | $0.02 per run |
| `apify-default-dataset-item` | $0 (results are billed via `product_scraped`) |

Each pushed product is charged in code via `Actor.push_data(..., charged_event_name='product_scraped')`.

### Run locally

```bash
pip install -r requirements.txt
playwright install chromium
apify run
```

### Deploy

```bash
apify login
apify push
```

Or link this Git repository (branch `v2`) in the Apify Console.

### Tests

Offline unit tests for the parsing/statistics helpers (no Apify needed):

```bash
python -m unittest discover -s tests -v
```

# Actor input Schema

## `start_urls` (type: `array`):

Skroutz.gr search or category URLs to scrape, e.g. https://www.skroutz.gr/search?keyphrase=lenovo+laptop

## `max_requests_per_crawl` (type: `integer`):

Maximum number of pages to process in total (across all start URLs and pagination)

## `max_pages_per_url` (type: `integer`):

How many result pages to follow per start URL (pagination)

## `max_concurrency` (type: `integer`):

Maximum number of headless browser pages running in parallel (1-5 recommended)

## `request_timeout_seconds` (type: `integer`):

Navigation and handler timeout for each page

## `max_retries` (type: `integer`):

How many times a failed page is retried before being skipped

## `proxy_configuration` (type: `object`):

Proxy settings for anti-bot protection (Apify Proxy recommended for Skroutz)

## `save_debug_screenshots` (type: `boolean`):

Save a PNG screenshot to the key-value store (debug/ prefix) when a page yields no products or fails

## Actor input object example

```json
{
  "start_urls": [
    {
      "url": "https://www.skroutz.gr/search?keyphrase=lenovo+laptop"
    },
    {
      "url": "https://www.skroutz.gr/search?keyphrase=hp+laptop"
    },
    {
      "url": "https://www.skroutz.gr/search?keyphrase=dell+laptop"
    }
  ],
  "max_requests_per_crawl": 20,
  "max_pages_per_url": 1,
  "max_concurrency": 2,
  "request_timeout_seconds": 60,
  "max_retries": 3,
  "proxy_configuration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "save_debug_screenshots": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `category_statistics` (type: `string`):

No description

## `run_summary` (type: `string`):

No description

# 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 = {
    "start_urls": [
        {
            "url": "https://www.skroutz.gr/search?keyphrase=lenovo+laptop"
        },
        {
            "url": "https://www.skroutz.gr/search?keyphrase=hp+laptop"
        },
        {
            "url": "https://www.skroutz.gr/search?keyphrase=dell+laptop"
        }
    ],
    "proxy_configuration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("mpelas/mpelas-myactor-skroutz-v2").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 = {
    "start_urls": [
        { "url": "https://www.skroutz.gr/search?keyphrase=lenovo+laptop" },
        { "url": "https://www.skroutz.gr/search?keyphrase=hp+laptop" },
        { "url": "https://www.skroutz.gr/search?keyphrase=dell+laptop" },
    ],
    "proxy_configuration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("mpelas/mpelas-myactor-skroutz-v2").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 '{
  "start_urls": [
    {
      "url": "https://www.skroutz.gr/search?keyphrase=lenovo+laptop"
    },
    {
      "url": "https://www.skroutz.gr/search?keyphrase=hp+laptop"
    },
    {
      "url": "https://www.skroutz.gr/search?keyphrase=dell+laptop"
    }
  ],
  "proxy_configuration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call mpelas/mpelas-myactor-skroutz-v2 --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mpelas/mpelas-myactor-skroutz-v2"
        }
    }
}
```

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/FsZ7JLuNLGaxmddWx/builds/x5HsNACC6wGKFoo8q/openapi.json
