Skip to content
FJFiras JdayTech Lead · Software Engineer
AboutServicesProjectsExperienceBlogGet in touch
Back to projects
  1. Home
  2. Projects
  3. LeBonCoin Data Extractor: Bot-Detection Architecture & Bypass Research
LeBonCoin Data Extractor: Bot-Detection Architecture & Bypass Research
Web Scraping & Research

LeBonCoin Data Extractor: Bot-Detection Architecture & Bypass Research

Python research project demonstrating residential proxy networks, JS rendering, and multi-tier extraction strategies against modern bot-detection systems.

2025 · Solo Developer

Project overview

The challenge

  • Leboncoin.fr implements sophisticated anti-scraping protection that blocks automated requests and bot traffic, making traditional scraping approaches ineffective.
  • Phone numbers are only revealed after JavaScript execution and user interaction, requiring full browser rendering capabilities rather than simple HTML parsing.
  • Access to local listings requires French IP addresses due to geolocation restrictions, creating barriers for international scraping operations.
  • Frequent HTML structure changes and dynamic CSS classes require robust extraction strategies to maintain reliability over time.
  • Need to balance extraction success rate with API costs for scalable operations, optimizing the cost-per-contact metric.

Research project exploring modern bot-detection architectures by building a structured data extractor targeting Leboncoin.fr, France's largest classified-ads platform.

Implemented ScrapFly's residential proxy network with French geolocation and JavaScript rendering, demonstrating how dynamic content protection and geolocation restrictions interact with automated clients.

Designed a robust 3-tier fallback extraction strategy combining HTML selectors, link detection, and regex patterns to handle frequent HTML structure changes — a common challenge in production data pipelines.

Optimised for cost efficiency with configurable limits and environment-based configuration, demonstrating $0.33 per 10 records while maintaining high success rates across light to heavy usage patterns.

Technical architecture

Click diagram to zoom

ScrapFly Integration Layer: Handles API authentication, anti-scraping protection bypass, and residential proxy configuration with French geolocation

Two-Phase Scraping Pipeline: Phase 1 collects ad URLs from search results, Phase 2 extracts detailed information including phone numbers

Multi-Method Phone Extraction: Implements 3-tier fallback strategy using HTML selectors, phone links, and regex patterns with French format validation

Data Processing Pipeline: BeautifulSoup HTML parsing with robust price extraction handling Unicode spaces and structured JSON output

Key challenges & solutions

1

Anti-Scraping Detection

Implemented ScrapFly's ASP bypass with residential proxy rotation, realistic browser headers, and auto-retry mechanism to avoid detection and blocking.

2

JavaScript-Rendered Content

Enabled full JavaScript execution with 3-second rendering wait, DOM readiness checks, and auto-scroll to trigger lazy-loaded phone numbers.

3

Dynamic HTML Selectors

Built 3-tier fallback extraction using data-qa-id attributes, tel: links, and regex patterns to handle frequent HTML structure changes.

4

Cost Optimization

Implemented configurable limits, environment-based tuning, and efficient two-phase approach to minimize API costs while maintaining quality.

5

Data Validation

Created comprehensive validation system with regex patterns, length checks, prefix validation, and duplicate detection for data quality.

Impact & results

Achieved 100% phone extraction success rate in production tests (10/10 contacts)

Optimized performance to 60 seconds execution time for 10 contacts

Reduced cost to $0.33 per 10 contacts through efficient API usage

Enabled scalable operations from $4.50/month (light) to $30/month (heavy usage)

Open-sourced with MIT license, comprehensive documentation, and validation reports

Key features

  • Bot-detection architecture research using ScrapFly ASP
  • Residential French proxies demonstrating geolocation-based access patterns
  • JavaScript rendering for dynamically-loaded content
  • Multi-method extraction with 3-tier fallback strategy
  • Robust price parsing with Unicode space handling
  • Environment-based configuration (.env support)
  • Comprehensive error handling and logging
  • Production-validated with detailed test reports

Technologies used

PythonScrapFly SDKBeautifulSoup4Regexpython-dotenvJSON
View source code

Project gallery

Technical Architecture: Two-phase scraping pipeline with anti-scraping bypass
Technical Architecture: Two-phase scraping pipeline with anti-scraping bypass
Web scraping system with residential proxies and JavaScript rendering
Web scraping system with residential proxies and JavaScript rendering

Project details

Client
Personal Project
Timeline
2025
Role
Solo Developer

© 2026 Firas Jday · Tech Lead & Senior Software Engineer · Tunis, Tunisia

Available for CDI & senior freelance — French & international market · jdayfiras.com

0%