Leboncoin extractor avatar
Leboncoin extractor
Try for free

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

View all Actors
Leboncoin extractor

Leboncoin extractor

anchor/leboncoin
Try for free

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

Extract information from leboncoin.fr : no limitation, you get fast results in CSV, Excel... or API format. Le meilleur outil de scrapping pour leboncoin

The code examples below show how to run the Actor and get its results. To run the code, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token, which you can find under Settings > Integrations in Apify Console. Learn mode

Node.js

Python

curl

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.leboncoin.fr/recherche?category=21&text=mer&price=17-50"
10    }
11  ],
12  "pageFunction": "async function pageFunction(context) {\n    let data = {}\n    let userData = context.request.userData\n    data.url = context.request.url\n    data.label = userData.label\n\n    let items = await context.page.evaluate(() => {\n        const item = $('[data-qa-id=aditem_container]')\n        const itemInfo = item.map(function(i,elem) {\n            let obj = {}\n            obj.title = $(this).find('[data-qa-id=aditem_title]').text()\n            obj.price = $(this).find('[data-test-id=price]').text()\n            obj.location = $(this).find('span[aria-label], p[aria-label]').filter(function() { return this['aria-label']?.match(/[0-9]{5}/);}).text()\n            obj.date = $(this).find('span[aria-label], p[aria-label]').filter(function() { return this.title?.match(/:/);}).text()\n            obj.img = $(this).find('a img:first').attr('src')\n            obj.rank = i+1\n            return obj\n        }).get()\n        return itemInfo\n    })\n    let itemsWithDataProp = items.map(obj => { \n        for(const key of Object.keys(data) ){\n            obj[key] = data[key]\n        }\n        return obj\n    })\n    return itemsWithDataProp;\n}\n",
13  "proxyConfiguration": {
14    "useApifyProxy": true,
15    "apifyProxyGroups": [
16      "RESIDENTIAL"
17    ],
18    "apifyProxyCountry": "FR"
19  }
20}
21EOF
22
23# Run the Actor using an HTTP API
24# See the full API reference at https://docs.apify.com/api/v2
25curl "https://api.apify.com/v2/acts/anchor~leboncoin/runs?token=$API_TOKEN" \
26  -X POST \
27  -d @input.json \
28  -H 'Content-Type: application/json'
Developer
Maintained by Community
Actor metrics
  • 9 monthly users
  • 91.5% runs succeeded
  • 0.0 days response time
  • Created in Oct 2021
  • Modified 8 days ago