Doctolib avatar

Doctolib

Try for free

3 days trial then $19.00/month - No credit card required now

View all Actors
Doctolib

Doctolib

anchor/doctolib
Try for free

3 days trial then $19.00/month - No credit card required now

Scraping Doctolib is now super easy and cheap! Extract phones, names, contact, timings, image and addresses of medics, doctors, hospitals... Best part : you can even customize what info to extract from Doctolib!

You can access the Doctolib programmatically from your own applications by using the Apify API. You can choose the language preference from below. To use the Apify API, you’ll need an Apify account and your API token, found in Integrations settings in Apify Console.

1# Set API token
2API_TOKEN=<YOUR_API_TOKEN>
3
4# Prepare Actor input
5cat > input.json << 'EOF'
6{
7  "startUrls": [
8    {
9      "url": "https://www.doctolib.fr/infectiologue/75001-paris"
10    }
11  ],
12  "pageFunction": "async function pageFunction(context) {\n\n    let data = {}\n    let userData = context.request.userData\n    data.url = context.request.url\n    data.label = userData.label\n    \n    if(userData && userData.label === 'doctor'){   \n        data.nom = await context.page.locator('#main-content h1').innerText({timeout:6000})\n        data.tarif = await context.innerTextwrapper(context,'#payment_means')\n        data.horaire_contact = await context.innerTextwrapper(context,'#openings_and_contact')\n        data.description = await context.innerTextwrapper(context,'.dl-profile-bio')\n        data.specialite = await context.innerTextwrapper(context,'.dl-profile-header-speciality')\n        data.expertise = await context.innerTextwrapper(context,'#skills')\n        try{\n            data.phones = await context.getPhones(data.horaire_contact)\n        }catch(e){\n            context.log.info('Phones not found',e);     \n        }\n        try{\n            data.image = await context.page.locator('.dl-profile img').first().getAttribute('src',{timeout:2000})\n            if(data.image.startsWith('/')){ data.image = 'https:' + data.image}\n        }catch(e){\n            context.log.info('Image not found',e);     \n        }        \n        \n    }else{\n        context.log.info('we are not on a doctor page: so a search or pagination page.');\n        userData.label = 'doctor';\n        const elements = context.page.locator('.search-result-card a[href]');\n        const links = await elements.evaluateAll(elems => elems.map(elem => elem.getAttribute('href')));\n        let extenstion = 'fr'\n        if(context.request.url.includes('doctolib.de')){ extenstion = 'de' }\n        if(context.request.url.includes('doctolib.it')){ extenstion = 'it' }\n        links.forEach(async link => {\n            if(link.startsWith('/')){ link = `https://www.doctolib.${extenstion}${link}` }\n            await context.enqueueRequest(link, userData , true);\n        })\n\n    }\n    context.log.info(`ending this page now`);\n    delete data.label\n    return data;\n}\n"
13}
14EOF
15
16# Run the Actor using an HTTP API
17# See the full API reference at https://docs.apify.com/api/v2
18curl "https://api.apify.com/v2/acts/anchor~doctolib/runs?token=$API_TOKEN" \
19  -X POST \
20  -d @input.json \
21  -H 'Content-Type: application/json'

Doctolib scraper API

Below, you can find a list of relevant HTTP API endpoints for calling the Doctolib Actor. For this, you’ll need an Apify account. Replace <YOUR_API_TOKEN> in the URLs with your Apify API token, which you can find under Integrations in Apify Console. For details, see the API reference .

Run Actor

POST
https://api.apify.com/v2/acts/anchor~doctolib/runs?token=<YOUR_API_TOKEN>

Note: By adding the method=POST query parameter, this API endpoint can be called using a GET request and thus used in third-party webhooks. Please refer to our Run Actor API documentation .

Run Actor synchronously and get dataset items

POST
https://api.apify.com/v2/acts/anchor~doctolib/run-sync-get-dataset-items?token=<YOUR_API_TOKEN>

Note: This endpoint supports both POST and GET request methods. However, only the POST method allows you to pass input data. For more information, please refer to our Run Actor synchronously and get dataset items API documentation .

Get Actor

GET
https://api.apify.com/v2/acts/anchor~doctolib?token=<YOUR_API_TOKEN>

For more information, please refer to our Get Actor API documentation .

Actors can be used to scrape web pages, extract data, or automate browser tasks. Use the Doctolib API programmatically via the Apify API.

You can choose from:

You can start Doctolib with the Apify API by sending an HTTP POST request to the Run Actor endpoint. An Actor’s input and its content type can be passed as a payload of the POST request, and additional options can be specified using URL query parameters. The Doctolib is identified within the API by its ID, which is the creator’s username and the name of the Actor.

When the Doctolib run finishes you can list the data from its default dataset (storage) via the API or you can preview the data directly on Apify Console .

Developer
Maintained by Community
Actor metrics
  • 10 monthly users
  • 4 stars
  • 89.8% runs succeeded
  • 7.6 hours response time
  • Created in Jul 2022
  • Modified 18 days ago