# worldometers-population-scraper (`miracbirben/worldometers-population-scraper`) Actor

- **URL**: https://apify.com/miracbirben/worldometers-population-scraper.md
- **Developed by:** [Miraç Birben](https://apify.com/miracbirben) (community)
- **Categories:** Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $40.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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

code
Markdown
download
content\_copy
expand\_less

## Worldometers Population Scraper (Python, Crawlee, Playwright)

This Apify Actor is designed to collect live population and related demographic data (births, deaths, population growth, etc.) from the Worldometers.info website. It reliably scrapes dynamically loaded content and JavaScript-updated counters using `PlaywrightCrawler`.

### Features

- **Live Counter Data:** Extracts current world population, births today and this year, deaths today and this year, and population growth from Worldometers.info.
- **Playwright Automation:** Seamlessly handles dynamically loaded data and JavaScript-rendered pages.
- **Intelligent Data Extraction:** Uses robust XPath and CSS selectors to identify counter values based on their labels.
- **Data Cleaning and Transformation:** Converts extracted numerical values into readable integers.
- **Error Tolerance:** Continues processing even if counters load with a delay.
- **Proxy Support:** Supports Apify Proxy configuration to prevent IP blocking.
- **Optimized Crawling:** Improves performance by blocking unnecessary resources (images, media, fonts, stylesheets).

### Quick Start

Follow these steps to run this Actor on the Apify platform or develop it locally.

#### Install Dependencies

Before running the project locally, you need to install the Python dependencies:

````bash
pip install -r requirements.txt
Run the Actor

Run Locally:

After cloning the project, you can start the Actor locally by running the following command in the root directory:

code
Bash
download
content_copy
expand_less
apify run

Deploy to Apify Console:

To upload the Actor to the Apify Console, follow these steps:

Log in to your Apify account:

code
Bash
download
content_copy
expand_less
apify login

Push the Actor to the Apify platform:

code
Bash
download
content_copy
expand_less
apify push
Input Configuration

The Actor expects a JSON object with the following structure:

code
JSON
download
content_copy
expand_less
{
  "start_urls": [
    {
      "url": "https://www.worldometers.info/world-population/"
    }
  ],
  "maxRequestsPerCrawl": 10,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}

start_urls (array of objects): A list of URLs to start scraping from. Each object must have a url property.

maxRequestsPerCrawl (integer, default: 10): The maximum number of pages the crawler will visit. (This value might not be kept high, as Worldometers data is usually on a single main page.)

proxyConfiguration (object, default: {"useApifyProxy": true}): Proxy settings. Set "useApifyProxy": true to use Apify Proxy.

Output Data

The Actor pushes JSON objects with the following structure to the Apify Dataset:

code
JSON
download
content_copy
expand_less
{
  "Current World Population": 8123456789,
  "Births today": 123456,
  "Deaths today": 56789,
  "Population Growth today": 66667,
  "Births this year": 12345678,
  "Deaths this year": 5678901,
  "Population Growth this year": 6666777,
  "source_url": "https://www.worldometers.info/world-population/",
  "scraped_at": "now"
}

All population and counter fields (Current World Population, Births today, etc.) are of type int or null if data is not found.

source_url: The URL of the page from which the data was extracted.

scraped_at: The timestamp when the data was scraped.

Project Structure
code
Text
download
content_copy
expand_less
.actor/
├── actor.json           # Actor configuration: name, version, environment variables, etc.
├── dataset_schema.json  # Schema for the output dataset
├── input_schema.json    # Schema for the Actor's input parameters and Console form
└── output_schema.json   # Schema for the Actor's overall output
src/
├── __init__.py          # Initialization file for the Python package
├── __main__.py          # Main entry point for the Actor (used by apify run/call)
├── main.py              # Contains the crawler logic and data extraction processes
└── py.typed             # Specifies type hints for tools like MyPy
storage/                 # Local storage (mirrors Apify Cloud during development)
├── datasets/            # Output items (as JSON objects)
├── key_value_stores/    # INPUT configuration and other files
└── request_queues/      # Pending crawl requests
AGENTS.md                # Notes for agents and developers regarding maintenance and logic
Dockerfile               # Definition of the Docker container image in which the Actor will run
README.md                # General information and usage guide for this project
requirements.txt         # List of Python dependencies
Maintenance and Development

Selector Updates: If the Worldometers.info website structure changes, the Playwright selectors within src/main.py (page.wait_for_selector, page.locator(xpath)) may need to be updated.

Performance: The resource blocking logic (page.route) is carefully configured. It is recommended to preserve these optimizations unless a critical style or font prevents counters from being visible.

Debugging: During development, you can set headless=False to open the browser visually and monitor Actor.log.info messages.

Additional Resources

Apify SDK for Python documentation

Crawlee for Python documentation

Playwright Python documentation

Apify Platform documentation

Apify Developer Community (Discord)

code
Code
download
content_copy
expand_less

# Actor input Schema

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

URLs to start scraping from.
## `maxRequestsPerCrawl` (type: `integer`):

Maximum number of pages to visit.
## `proxyConfiguration` (type: `object`):

Select proxies to avoid blocking.

## Actor input object example

```json
{
  "start_urls": [
    {
      "url": "https://www.worldometers.info/world-population/"
    }
  ],
  "maxRequestsPerCrawl": 10,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
````

# 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.worldometers.info/world-population/"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("miracbirben/worldometers-population-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 = { "start_urls": [{ "url": "https://www.worldometers.info/world-population/" }] }

# Run the Actor and wait for it to finish
run = client.actor("miracbirben/worldometers-population-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 '{
  "start_urls": [
    {
      "url": "https://www.worldometers.info/world-population/"
    }
  ]
}' |
apify call miracbirben/worldometers-population-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,miracbirben/worldometers-population-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/OnN8TmeBNMq6vlEvf/builds/KOP2zx05rE0hLrGx1/openapi.json
