How to Scrape Leboncoin Using HAR File

In this tutorial, you will learn how to get all the listings on Leboncoin without using any scraping software, legally, by utilizing the HAR file from your browser.

*This video is in French, but you can enable subtitles.

Step 1: Record the HAR File

The steps on Firefox :

  1. Navigate to Leboncoin:
    • Go on leboncoin.fr.
  2. Open Developer Tools:
    • Press F12 to open the Developer Tools.
    • Go to the “Network” tab.
  3. Enable Log Preservation:
    • Select “Persist log” on the setting to keep the network logs even when navigating to different pages.
  4. Filter URLs:
    • On “Filter URLs” put : api.leboncoin.fr/finder/search
  5. Navigate Through the Pages:
    • Search for what you want to scrape on Leboncoin.
    • Example: https://www.leboncoin.fr/f/ventes_immobilieres/real_estate_type--2.
    • Go to all the pages you want to scrape.
  6. Download the HAR File:
    • Once you have navigated through all the pages, right-click on the network requests list and select “Save All As HAR”.

Step 2: Analyze the HAR File with Our Tool

Leboncoin har scraping

  • Visit the Tool:
  • Upload the HAR File:
    • Select and upload the HAR file you just saved.
  • Enter URL Part:
    • In the field “Enter a part of the URL“, input:
api.leboncoin.fr/finder/search
  • Enter JSON Selectors:
    • In the field “Enter XPath or CSS selectors, one per line“, input the following:
ads

Analyze the HAR File:

  • Click on the button “Search”.

Export the Results:

  • Once the analysis is complete, you will see the results.
  • You can download the results as a CSV file by clicking on “Download CSV Results”.

One comment

Leave a Reply to Tal FreibergsCancel Reply

Your email address will not be published. Required fields are marked *