# Administration Data Scraper

Extract public services information (working hours, location, phone, fax etc.) from Administration Data Scraper using keywords as input

- Template page: [https://www.octoparse.com/template/lannuaire-service-public-scraper](https://www.octoparse.com/template/lannuaire-service-public-scraper)
- Categories: Directories
- Status: `PUBLISHED`
- Run mode: `BOTH`

## Pricing

Free.

## What is an Octoparse template?

An Octoparse template is a ready-to-use scraping workflow with predefined inputs and structured outputs. Use the exact parameter keys below; do not invent parameters.

## Overview

This ready-to-use template collects structured data from general web pages.

## Output

The current workflow extracts 9 fields, including `Administration`, `Code_Postal`, `Fax`, `Horaires`, `Lieu`, `Site`, `Text`, `Téléphone`, `URL_de_la_page_détaillée`.

## Use Cases

- Use structured results for research, comparison, and monitoring.
- Collect rows without building the extraction workflow from scratch.
- Combine results with other templates for downstream enrichment.
- Review a representative result before starting a large batch.

## Why Octoparse

- **No coding required:** complete A pair of keyword (Who/What ; Where) and start the template in local or cloud mode.
- **Flexible export:** review and export results as CSV, Excel, or JSON.

## Input

### A pair of keyword (Who/What ; Where)

Required. A pair of keywords, separated by a semicolon, without spaces before or after the semicolon. Constraints: minItems=1; maxItems=10000.

## How to Use

## Administration Data Scraper

### Description
Collects public services information (working hours, location, phone, fax, etc.) from [Service Public](https://lannuaire.service-public.fr/) using keywords.

### Input
- **A pair of keyword (Who/What ; Where)** (required): Enter one or more values, one per line.

### Output
Returns these fields:
- `Administration`
- `Horaires`
- `Lieu`
- `Code_Postal`
- `Site`
- `Téléphone`
- `Fax`
- `URL_de_la_page_détaillée`
- `Text`

### How to Use
1. Open the template and select **Try it** or **Start**.
2. Complete the input fields.
3. Choose a local or cloud run.
4. Review the output rows and export or process the structured data.

### Limitations
- Collects only the fields listed in Output from detail pages; does not add data that Service Public does not display.
- Fields such as `Fax`, `URL_de_la_page_détaillée`, and `Text` can be empty when the source record does not provide them.

### Tips
- Start with one or a few inputs and review the returned rows before scaling.
- Use the most specific valid keywords to reduce unrelated or duplicate records.
- Use a stable identifier from the output (e.g., `Administration`, `URL_de_la_page_détaillée`) as a deduplication key when available.

## Limitations

Results depend on what the source site exposes at run time. Fields may be empty when a source page does not provide a value. The template enforces the input limits shown above.

## Tips

Use specific, valid inputs and review a representative result before starting a large batch. Remove duplicate inputs when repeated records are not needed.

## FAQ

### What do I need to enter?

Use the exact inputs and limits listed above.

### What data does this template return?

See Output Schema below; availability can vary by source record.

### How is usage billed?

See the Pricing section above for current pricing and billing details.

## Related Templates

- [Leboncoin Data Scraper](https://www.octoparse.com/template/leboncoin-data-scraper)
- [North Data Scraper](https://www.octoparse.com/template/north-data-scraper)
- [Kompass Data Scraper](https://www.octoparse.com/template/kompass-scraper)
- [Vinted Data Scraper (by keywords)](https://www.octoparse.com/template/vinted-data-scraper)
- [Pap.fr Immobilier Data Scraper](https://www.octoparse.com/template/pap-scraper)

## Input Schema

```json
{
  "title": "Administration Data Scraper input",
  "description": "Input parameters configured for the current published template version.",
  "type": "object",
  "schemaVersion": 1,
  "additionalProperties": false,
  "properties": {
    "a_pair_of_keyword": {
      "title": "A pair of keyword (Who/What ; Where)",
      "description": "A pair of keywords, separated by a semicolon, without spaces before or after the semicolon.",
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 1,
      "maxItems": 10000,
      "x-octoparse": {
        "apiEnabled": true
      }
    }
  },
  "required": [
    "a_pair_of_keyword"
  ]
}
```

## Input JSON Example

Example 1

```json
{
  "a_pair_of_keyword": [
    "Mairie;Toulouse"
  ]
}
```

Example 2

```json
{
  "a_pair_of_keyword": [
    "Mairie;Toulouse"
  ]
}
```


## Output Schema

```json
{
  "schemaVersion": 1,
  "type": "object",
  "properties": {
    "Administration": {
      "type": "string",
      "description": ""
    },
    "Code_Postal": {
      "type": "string",
      "description": ""
    },
    "Fax": {
      "type": "string",
      "description": ""
    },
    "Horaires": {
      "type": "string",
      "description": ""
    },
    "Lieu": {
      "type": "string",
      "description": ""
    },
    "Site": {
      "type": "string",
      "description": ""
    },
    "Text": {
      "type": "string",
      "description": ""
    },
    "Téléphone": {
      "type": "string",
      "description": ""
    },
    "URL_de_la_page_détaillée": {
      "type": "string",
      "description": ""
    }
  },
  "title": "Administration Data Scraper output",
  "description": "Initial output fields derived from the current published implementation. Field descriptions are maintained by Data Center; production field names and types should be refreshed from recent successful runs.",
  "additionalProperties": false
}
```

## Output Example

Example 1

```json
{
  "Administration": "Mairie - Toulouse",
  "Code_Postal": "31040 ",
  "Fax": "05 61 22 22 75",
  "Horaires": "Du Lundi au Vendredi : de 08h30 à 18h00\n",
  "Lieu": "1 place du Capitole 31040 Toulouse Cedex 6 France",
  "Site": "https://metropole.toulouse.fr/",
  "Text": "AccueilAnnuaireOccitanieHaute-Garonne - 31Mairie - Toulouse",
  "Téléphone": "05 61 22 22 22",
  "URL_de_la_page_détaillée": "https://lannuaire.service-public.gouv.fr/occitanie/haute-garonne/f58cc559-cc0e-46c2-9b52-1af8c0d479e4"
}
```

Example 2

```json
{
  "Administration": "Mairie - Toulouse",
  "Code_Postal": "31040 ",
  "Fax": "05 61 22 22 75",
  "Horaires": "Du Lundi au Vendredi : de 08h30 à 17h00\n",
  "Lieu": "1 place du Capitole 31040 Toulouse Cedex 6 France",
  "Site": "https://metropole.toulouse.fr/",
  "Text": "AccueilAnnuaireOccitanieHaute-Garonne - 31Mairie - Toulouse",
  "Téléphone": "05 61 22 29 22",
  "URL_de_la_page_détaillée": "https://lannuaire.service-public.gouv.fr/occitanie/haute-garonne/f58cc559-cc0e-46c2-9b52-1af8c0d479e4"
}
```

## API

`POST https://openapi.octoparse.com/api/agentTools/executeTask`

This is the OpenAPI Agent Tools `executeTask` endpoint. Authenticate with a Bearer token.

Request body:

`templateName` is the template slug; `parameters` is a JSON object string whose keys match Input Schema; `taskName`, `idempotencyKey`, and `maxCollectedRows` are optional.

Obtain a token:

```http
POST https://openapi.octoparse.com/token
Content-Type: application/json

{
  "username": "YOUR_USERNAME",
  "password": "YOUR_PASSWORD",
  "grant_type": "password"
}
```

Use `data.access_token` as `Authorization: Bearer <token>`. After starting, poll `getTaskStatus` and export with `exportData`.

```json
{
  "templateName": "lannuaire-service-public-scraper",
  "taskName": "Administration Data Scraper",
  "parameters": "{\"a_pair_of_keyword\":[\"Mairie;Toulouse\"]}"
}
```

## Python Example

```python
import json
import requests

OPENAPI_BASE = "https://openapi.octoparse.com"
ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"

parameters = json.loads("{\"a_pair_of_keyword\":[\"Mairie;Toulouse\"]}")

response = requests.post(
    f"{OPENAPI_BASE}/api/agentTools/executeTask",
    headers={
        "Authorization": f"Bearer {ACCESS_TOKEN}",
        "Content-Type": "application/json",
    },
    json={
        "templateName": "lannuaire-service-public-scraper",
        "taskName": "Administration Data Scraper",
        "parameters": json.dumps(parameters, ensure_ascii=False),
    },
    timeout=60,
)
print(response.status_code)
print(response.json())
```

## HTTP/cURL Example

```bash
curl -X POST "https://openapi.octoparse.com/api/agentTools/executeTask" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "templateName": "lannuaire-service-public-scraper",
  "taskName": "Administration Data Scraper",
  "parameters": "{\"a_pair_of_keyword\":[\"Mairie;Toulouse\"]}"
}
JSON
```

## MCP Setup

Connect an MCP-compatible AI client to `https://mcp.octoparse.com` using browser OAuth or an Octoparse API key. Find `lannuaire-service-public-scraper`, inspect its inputs, create a cloud task with the exact Input Schema keys, and export JSON results.

## Machine-readable Resources

- [Template contract](https://www.octoparse.com/templates/lannuaire-service-public-scraper.json)
- [Manifest](https://www.octoparse.com/templates/lannuaire-service-public-scraper-manifest.json)
