Boulanger avatar
Boulanger
Try for free

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

View all Actors
Boulanger

Boulanger

anchor/boulanger
Try for free

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

Extract information from boulanlger : simply provide your search URL (+ your filters and location). You will get the results easy, and fast

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.boulanger.com/resultats?tr=samsung"
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 = $('.product-item')\n        // const item = $('.rm-product')\n        const itemInfo = item.map(function(i,elem) {\n            let obj = {}\n            obj.title = $(this).find('h2').text()\n            obj.sponsored = false\n            obj.price = $(this).find('.price__amount').text()\n            obj.img = $(this).find('img').attr('src')\n            obj.rank = i+1\n            return obj\n        }).get()\n\n        const itemSponsored = $('.rm-product')\n        const itemInfoSponsored = itemSponsored.map(function(i,elem) {\n            let obj = {}\n            obj.title = $(this).find('h2').text()\n            obj.sponsored = true\n            obj.price = $(this).find('.rm_price').text()\n            obj.img = $(this).find('img').attr('src')\n            obj.rank = i+1\n            return obj\n        }).get()\n\n        // return [...itemInfo,...itemInfoSponsored]\n        const allitems = itemInfoSponsored.concat(itemInfo)\n        return allitems\n    })\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
24curl "https://api.apify.com/v2/acts/anchor~boulanger/runs?token=$API_TOKEN" \
25  -X POST \
26  -d @input.json \
27  -H 'Content-Type: application/json'
Developer
Community logoMaintained by Community
Actor metrics
  • 1 monthly users
  • 100.0% runs succeeded
  • Modified 18 days ago

You might also like these Actors