Boulanger
This Actor is unavailable because the developer has decided to deprecate it. Would you like to try a similar Actor instead?
See alternative ActorsBoulanger
Extract information from boulanlger : simply provide your search URL (+ your filters and location). You will get the results easy, and fast
You can access the Boulanger programmatically from your own JavaScript applications by using the Apify API. You can also 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.
1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4// Replace the '<YOUR_API_TOKEN>' with your token
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9// Prepare Actor input
10const input = {
11 "startUrls": [
12 {
13 "url": "https://www.boulanger.com/resultats?tr=samsung"
14 }
15 ],
16 "pageFunction": async function pageFunction(context) {
17 let data = {}
18 let userData = context.request.userData
19 data.url = context.request.url
20 data.label = userData.label
21
22 let items = await context.page.evaluate(() => {
23 const item = $('.product-item')
24 // const item = $('.rm-product')
25 const itemInfo = item.map(function(i,elem) {
26 let obj = {}
27 obj.title = $(this).find('h2').text()
28 obj.sponsored = false
29 obj.price = $(this).find('.price__amount').text()
30 obj.img = $(this).find('img').attr('src')
31 obj.rank = i+1
32 return obj
33 }).get()
34
35 const itemSponsored = $('.rm-product')
36 const itemInfoSponsored = itemSponsored.map(function(i,elem) {
37 let obj = {}
38 obj.title = $(this).find('h2').text()
39 obj.sponsored = true
40 obj.price = $(this).find('.rm_price').text()
41 obj.img = $(this).find('img').attr('src')
42 obj.rank = i+1
43 return obj
44 }).get()
45
46 // return [...itemInfo,...itemInfoSponsored]
47 const allitems = itemInfoSponsored.concat(itemInfo)
48 return allitems
49 })
50
51 let itemsWithDataProp = items.map(obj => {
52 for(const key of Object.keys(data) ){
53 obj[key] = data[key]
54 }
55 return obj
56 })
57 return itemsWithDataProp;
58 },
59 "proxyConfiguration": {
60 "useApifyProxy": true,
61 "apifyProxyGroups": [
62 "RESIDENTIAL"
63 ],
64 "apifyProxyCountry": "FR"
65 }
66};
67
68// Run the Actor and wait for it to finish
69const run = await client.actor("anchor/boulanger").call(input);
70
71// Fetch and print Actor results from the run's dataset (if any)
72console.log('Results from dataset');
73console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
74const { items } = await client.dataset(run.defaultDatasetId).listItems();
75items.forEach((item) => {
76 console.dir(item);
77});
78
79// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs
Boulanger API in JavaScript
The Apify API client for JavaScript is the official library that allows you to use Boulanger API in JavaScript or TypeScript, providing convenience functions and automatic retries on errors.
Install the apify-client
npm install apify-client
Other API clients include: