Leboncoin extractor
3 days trial then $19.00/month - No credit card required now
Leboncoin extractor
3 days trial then $19.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
You can access the Leboncoin extractor 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.leboncoin.fr/recherche?category=21&text=mer&price=17-50" }],
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 = $('[data-qa-id=aditem_container]')
18 const itemInfo = item.map(function(i,elem) {
19 let obj = {}
20 obj.title = $(this).find('[data-qa-id=aditem_title]').text()
21 obj.price = $(this).find('[data-test-id=price]').text()
22 obj.location = $(this).find('span[aria-label], p[aria-label]').filter(function() { return this['aria-label']?.match(/[0-9]{5}/);}).text()
23 obj.date = $(this).find('span[aria-label], p[aria-label]').filter(function() { return this.title?.match(/:/);}).text()
24 obj.img = $(this).find('a img:first').attr('src')
25 obj.rank = i+1
26 return obj
27 }).get()
28 return itemInfo
29 })
30 let itemsWithDataProp = items.map(obj => {
31 for(const key of Object.keys(data) ){
32 obj[key] = data[key]
33 }
34 return obj
35 })
36 return itemsWithDataProp;
37}
38""",
39 "proxyConfiguration": {
40 "useApifyProxy": True,
41 "apifyProxyGroups": ["RESIDENTIAL"],
42 "apifyProxyCountry": "FR",
43 },
44}
45
46# Run the Actor and wait for it to finish
47run = client.actor("anchor/leboncoin").call(run_input=run_input)
48
49# Fetch and print Actor results from the run's dataset (if there are any)
50print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
51for item in client.dataset(run["defaultDatasetId"]).iterate_items():
52 print(item)
53
54# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start
Leboncoin Extractor API in Python
The Apify API client for Python is the official library that allows you to use Leboncoin extractor API in Python, providing convenience functions and automatic retries on errors.
Install the apify-client
pip install apify-client
Other API clients include:
Actor Metrics
11 monthly users
-
6 stars
>99% runs succeeded
Created in Oct 2021
Modified a month ago