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 Python 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.
1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4# Replace '<YOUR_API_TOKEN>' with your token.
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7# Prepare the Actor input
8run_input = {
9 "startUrls": [{ "url": "https://www.boulanger.com/resultats?tr=samsung" }],
10 "pageFunction": """async function pageFunction(context) {
11 let data = {}
12 let userData = context.request.userData
13 data.url = context.request.url
14 data.label = userData.label
15
16 let items = await context.page.evaluate(() => {
17 const item = $('.product-item')
18 // const item = $('.rm-product')
19 const itemInfo = item.map(function(i,elem) {
20 let obj = {}
21 obj.title = $(this).find('h2').text()
22 obj.sponsored = false
23 obj.price = $(this).find('.price__amount').text()
24 obj.img = $(this).find('img').attr('src')
25 obj.rank = i+1
26 return obj
27 }).get()
28
29 const itemSponsored = $('.rm-product')
30 const itemInfoSponsored = itemSponsored.map(function(i,elem) {
31 let obj = {}
32 obj.title = $(this).find('h2').text()
33 obj.sponsored = true
34 obj.price = $(this).find('.rm_price').text()
35 obj.img = $(this).find('img').attr('src')
36 obj.rank = i+1
37 return obj
38 }).get()
39
40 // return [...itemInfo,...itemInfoSponsored]
41 const allitems = itemInfoSponsored.concat(itemInfo)
42 return allitems
43 })
44
45 let itemsWithDataProp = items.map(obj => {
46 for(const key of Object.keys(data) ){
47 obj[key] = data[key]
48 }
49 return obj
50 })
51 return itemsWithDataProp;
52}
53""",
54 "proxyConfiguration": {
55 "useApifyProxy": True,
56 "apifyProxyGroups": ["RESIDENTIAL"],
57 "apifyProxyCountry": "FR",
58 },
59}
60
61# Run the Actor and wait for it to finish
62run = client.actor("anchor/boulanger").call(run_input=run_input)
63
64# Fetch and print Actor results from the run's dataset (if there are any)
65print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
66for item in client.dataset(run["defaultDatasetId"]).iterate_items():
67 print(item)
68
69# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start
Boulanger API in Python
The Apify API client for Python is the official library that allows you to use Boulanger API in Python, providing convenience functions and automatic retries on errors.
Install the apify-client
pip install apify-client
Other API clients include: