Skip to content

DeepSilence/leboncoin-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leboncoin-api Build Status Coverage Status

NPM

Install

npm install leboncoin-api

Features

  • Search on leboncoin.fr with all functionality available leboncoin.fr
  • Get the detailed page of an item
  • Get the phone number of the seller (convert the image to string) /!\ This API have an unknown usage limit

Usage

const leboncoin = require('leboncoin-api');
var search = new leboncoin.Search()
    .setPage(1)
    .setQuery("renove")
    .setFilter(leboncoin.FILTERS.PARTICULIER)
    .setCategory("locations")
    .setRegion("ile_de_france")
    .setDepartment("yvelines")
    .setLocation([
                 {"zipcode": "78100"},
                 {"zipcode": "78000"},
                 ])
    .addSearchExtra("price", {min: 1500, max: 2000}) // will add a range of price
    .addSearchExtra('furnished', ["1", "Non meublé"]); // will add enums for Meublé and Non meublé

// Please check into categories & sub categories constants to know which are the sub categories to add into "addSearchExtra"

search.run().then(function (data) {
    console.log(data.page); // the current page
    console.log(data.pages); // the number of pages
    console.log(data.nbResult); // the number of results for this search
    console.log(data.results); // the array of results
    data.results[0].getDetails().then(function (details) {
        console.log(details); // the item 0 with more data such as description, all images, author, ...
    }, function (err) {
        console.error(err);
    });
    data.results[0].getPhoneNumber().then(function (phoneNumer) {
        console.log(phoneNumer); // the phone number of the author if available
    }, function (err) {
        console.error(err); // if the phone number is not available or not parsable (image -> string) 
    });
}, function (err) {
    console.error(err);
});

License MIT

Packages

No packages published

Languages

  • JavaScript 100.0%