Boulanger avatar
Boulanger
Deprecated
View all Actors
This Actor is deprecated

This Actor is unavailable because the developer has decided to deprecate it. Would you like to try a similar Actor instead?

See alternative Actors
Boulanger

Boulanger

anchor/boulanger

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 more

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