Leboncoin avatar

Leboncoin

Try for free

Pay $2.00 for 1,000 Listings

View all Actors
Leboncoin

Leboncoin

rigelbytes/leboncoin
Try for free

Pay $2.00 for 1,000 Listings

Leboncoin Listing Scraper: Effortlessly extract real estate listings from Leboncoin, the top French classifieds site. Get detailed information on properties, including prices, descriptions, and images, with customizable filters for phone numbers and listing counts. Perfect for real estate analysis!

Leboncoin Listing Scraper

This Leboncoin Listing Scraper actor is designed to scrape real estate listings from the popular French website Leboncoin. It allows users to extract listing data such as prices, descriptions, location details, and more, based on customizable input parameters.

📝 Copy for Use:

1{
2  "starturl": "https://www.leboncoin.fr/recherche?category=9&real_estate_type=2&immo_sell_type=old",
3  "has_phone": true,
4  "listing_count": 100
5}

Features

  • Scrapes real estate listings from Leboncoin based on a start URL.
  • Optional filter to only scrape listings that include a phone number.
  • Allows users to specify the number of listings to extract.
  • Supports the use of proxies for anonymity.
  • Outputs the scraped data into a structured JSON dataset.

How It Works

This actor accepts user-defined inputs via an input schema and produces structured output that can be used for data analysis, further automation, or simply extracting insights about real estate listings.

Input

The actor accepts the following input:

  • starturl (string, required): The starting URL for the search on Leboncoin. This is the URL from which the actor will begin scraping listings.

  • has_phone (boolean, optional): A flag to filter listings that include a phone number. If set to true, only listings with phone numbers will be included. Default is false.

  • listing_count (integer, required): Specifies the number of listings to extract. The actor will stop scraping once it has extracted the specified number of listings.

Copy URL

  • Select the Real-Estate category from the menu. Select Real-Estate

  • Apply your desired filters (e.g., price range, surface area). Apply Desired Filter

  • Copy the URL from your browser’s address bar after applying the filters. Copy URL

  • Paste this URL into the scraper to begin extracting listings based on your criteria.

Usage

Running via Apify Console

You can run this actor from the Apify Console by providing the necessary input parameters.

Running via API

You can trigger this actor using the Apify API, passing the required input in the request body.

API Request Example (Python)

1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your API token
4client = ApifyClient("<YOUR_API_TOKEN>")
5
6# Prepare the Actor input
7run_input = {
8    "starturl": "https://www.leboncoin.fr/recherche?category=9&real_estate_type=2&immo_sell_type=old",
9    "number_of_listings": 100,
10}
11
12# Run the Actor and wait for it to finish
13run = client.actor("rigelbytes/leboncoin").call(run_input=run_input)
14
15# Fetch and print Actor results from the run's dataset (if there are any)
16for item in client.dataset(run["defaultDatasetId"]).iterate_items():
17    print(item)

JavaScript

1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with API token
4const client = new ApifyClient({
5    token: '<YOUR_API_TOKEN>',
6});
7
8// Prepare Actor input
9const input = {
10    "starturl":"https://www.leboncoin.fr/recherche?category=9&real_estate_type=2&immo_sell_type=old",
11    "number_of_listings": 100
12};
13
14(async () => {
15    // Run the Actor and wait for it to finish
16    const run = await client.actor("rigelbytes/leboncoin").call(input);
17
18    // Fetch and print Actor results from the run's dataset (if any)
19    console.log('Results from dataset');
20    const { items } = await client.dataset(run.defaultDatasetId).listItems();
21    items.forEach((item) => {
22        console.dir(item);
23    });
24})();

Running with cURL

1# Set API token
2API_TOKEN=<YOUR_API_TOKEN>
3
4# Prepare Actor input
5cat > input.json <<'EOF'
6{
7"starturl":"https://www.leboncoin.fr/recherche?category=9&real_estate_type=2&immo_sell_type=old",
8  "number_of_listings": 100
9}
10EOF
11
12# Run the Actor
13curl "https://api.apify.com/v2/acts/rigelbytes/leboncoin/runs?token=$API_TOKEN" \
14  -X POST \
15  -d @input.json \
16  -H 'Content-Type: application/json'

Output

1{
2  "list_id": {
3    "type": "integer",
4    "description": "Unique ID of the listing"
5  },
6  "first_publication_date": {
7    "type": "string",
8    "format": "date-time",
9    "description": "First time the listing was published"
10  },
11  "expiration_date": {
12    "type": "string",
13    "format": "date-time",
14    "description": "Expiration date of the listing"
15  },
16  "index_date": {
17    "type": "string",
18    "format": "date-time",
19    "description": "Date the listing was indexed"
20  },
21  "status": {
22    "type": "string",
23    "description": "The status of the listing (active, expired, etc.)"
24  },
25  "category_id": {
26    "type": "string",
27    "description": "ID of the listing category"
28  },
29  "category_name": {
30    "type": "string",
31    "description": "Name of the category"
32  },
33  "subject": {
34    "type": "string",
35    "description": "Title of the listing"
36  },
37  "body": {
38    "type": "string",
39    "description": "Detailed description of the listing"
40  },
41  "brand": {
42    "type": "string",
43    "description": "Brand name of the platform"
44  },
45  "ad_type": {
46    "type": "string",
47    "description": "Type of advertisement (offer, request, etc.)"
48  },
49  "url": {
50    "type": "string",
51    "format": "uri",
52    "description": "URL of the listing"
53  },
54  "price": {
55    "type": "array",
56    "items": {
57      "type": "integer"
58    },
59    "description": "Array containing the price of the listing"
60  },
61  "price_cents": {
62    "type": "integer",
63    "description": "Price of the listing in cents"
64  },
65  "images": {
66    "type": "object",
67    "properties": {
68      "thumb_url": {
69        "type": "string",
70        "format": "uri",
71        "description": "Thumbnail URL of the main image"
72      },
73      "small_url": {
74        "type": "string",
75        "format": "uri",
76        "description": "Small-sized image URL"
77      },
78      "nb_images": {
79        "type": "integer",
80        "description": "Number of images in the listing"
81      },
82      "urls": {
83        "type": "array",
84        "items": {
85          "type": "string",
86          "format": "uri"
87        },
88        "description": "Array of image URLs"
89      },
90      "urls_thumb": {
91        "type": "array",
92        "items": {
93          "type": "string",
94          "format": "uri"
95        },
96        "description": "Array of thumbnail image URLs"
97      },
98      "urls_large": {
99        "type": "array",
100        "items": {
101          "type": "string",
102          "format": "uri"
103        },
104        "description": "Array of large-sized image URLs"
105      }
106    },
107    "description": "Image information for the listing"
108  },
109  "attributes": {
110    "type": "array",
111    "items": {
112      "type": "object",
113      "properties": {
114        "key": {
115          "type": "string",
116          "description": "Attribute key"
117        },
118        "value": {
119          "type": "string",
120          "description": "Attribute value"
121        },
122        "key_label": {
123          "type": "string",
124          "description": "Human-readable label for the attribute key"
125        },
126        "value_label": {
127          "type": "string",
128          "description": "Human-readable label for the attribute value"
129        },
130        "generic": {
131          "type": "boolean",
132          "description": "Whether the attribute is generic"
133        }
134      },
135      "required": ["key", "value"]
136    },
137    "description": "Array of listing attributes"
138  },
139  "location": {
140    "type": "object",
141    "properties": {
142      "country_id": {
143        "type": "string",
144        "description": "Country code"
145      },
146      "region_id": {
147        "type": "string",
148        "description": "Region code"
149      },
150      "region_name": {
151        "type": "string",
152        "description": "Name of the region"
153      },
154      "department_id": {
155        "type": "string",
156        "description": "Department code"
157      },
158      "department_name": {
159        "type": "string",
160        "description": "Department name"
161      },
162      "city_label": {
163        "type": "string",
164        "description": "City name with zipcode"
165      },
166      "zipcode": {
167        "type": "string",
168        "description": "Postal code"
169      },
170      "lat": {
171        "type": "number",
172        "description": "Latitude of the location"
173      },
174      "lng": {
175        "type": "number",
176        "description": "Longitude of the location"
177      }
178    },
179    "description": "Geographical information of the listing"
180  },
181  "owner": {
182    "type": "object",
183    "properties": {
184      "store_id": {
185        "type": "string",
186        "description": "ID of the store"
187      },
188      "user_id": {
189        "type": "string",
190        "description": "ID of the user"
191      },
192      "name": {
193        "type": "string",
194        "description": "Owner's name"
195      }
196    },
197    "description": "Owner information"
198  },
199  "options": {
200    "type": "object",
201    "properties": {
202      "has_option": {
203        "type": "boolean",
204        "description": "Whether the listing has options"
205      },
206      "booster": {
207        "type": "boolean",
208        "description": "Whether the listing is boosted"
209      },
210      "urgent": {
211        "type": "boolean",
212        "description": "Whether the listing is urgent"
213      }
214    },
215    "description": "Options for the listing"
216  },
217  "has_phone": {
218    "type": "boolean",
219    "description": "Indicates if the listing includes a phone number"
220  }
221}

Get Started Today!

To start using the Leboncoin Listing Scraper, follow the instructions above to configure your inputs. Join the growing community of users leveraging data for insights in the real estate market!

Contact Us

Ready to unlock the power of data? Reach out to us at (contact@rigelbytes.com) or book an appointment with us to learn more about how we can help you achieve your data goals.

Developer
Maintained by Community
Actor metrics
  • 6 monthly users
  • 2 stars
  • 100.0% runs succeeded
  • Created in Sep 2024
  • Modified 7 days ago