Crate lbc

Crate lbc 

Source
Expand description

§LBC-RS - Unofficial Leboncoin API Client

This crate provides an unofficial client for the Leboncoin API, allowing you to search for classified ads, retrieve user information, and access detailed ad data.

This project is heavily inspired by the excellent Python implementation: etienne-hd/lbc

§Features

  • Search classified ads with various filters
  • Retrieve detailed ad information
  • Get user profiles and information
  • Support for proxy configuration
  • Comprehensive location filtering (regions, departments, cities)
  • Built with async/await support

§Quick Start

use lbc::{Client, City, Category, Sort, AdType};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
     
    let location = City::new(48.85994982004764, 2.33801967847424, Some(10_000), Some("Paris".to_string()));
     
    let result = client.search()
        .text("maison")
        .locations(vec![location.into()])
        .page(1)
        .limit(35)
        .sort(Sort::Newest)
        .ad_type(AdType::Offer)
        .category(Category::Immobilier)
        .square(200, 400)
        .price(300_000, 700_000)
        .execute()
        .await?;
     
    for ad in result.ads {
        println!("{:?} - {:?} - {:?}", ad.url, ad.subject, ad.price());
    }
     
    Ok(())
}

Re-exports§

pub use client::Client;
pub use error::*;
pub use models::*;

Modules§

client
error
models
utils