npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

leboncoin-api-search

v0.0.7

Published

Leboncoin API - Faire des recherches sur leboncoin

Downloads

23

Readme

build npm version

Informations

Ce projet est une API non officielle pour le site leboncoin.fr. Elle permet de faire des recherches avec une complexité moyenne, je ne garantis pas que toutes les fonctionnalités du site soient disponibles.

C'est une librarie pour un projet personnel, il n'est pas sûr que je la maintienne à jour.

Je ne suis pas responsable de l'utilisation que vous en faites, je vous invite à lire les conditions d'utilisation du site.

  • [x] Recherche simple
  • [x] Recherche avancée
  • [ ] Recherche complexe
  • [x] Gestion des pages / offset
  • [ ] Connexion au compte (pas prévu)
  • [ ] Gestion du compte (pas prévu)
  • [ ] Messagerie (pas prévu)

Installation

# npm install leboncoin-api-search
bun add leboncoin-api-search

OU

git clone https://github.com/thomasync/leboncoin-api-search.git
cd leboncoin-api-search
# npm install
bun install

Utilisation

import { search, searchMultiples, getCategories, getFeaturesFromCategory } from 'leboncoin-api-search';

// Récuperer toutes les catégories
const categories = getCategories();

// Faire une recherche
const results = search({});

// Faire une recherche sur plusieurs pages
const results = searchMultiples({}, 10);

// Récupérer toutes les features (filtres) possible pour une catégorie
const features = getFeaturesFromCategory(CATEGORY.CONSOLES);

Exemples

1. Recherche d'appartements à Paris entre 50 000 et 100 000 euros

import { CATEGORY, SORT_BY, SORT_ORDER, getFeaturesFromCategory, search } from 'leboncoin-api-search';

const typeVente = 'Appartement';
const featureVente = getFeaturesFromCategory(CATEGORY.VENTES_IMMOBILIERES).find(
	(feature) => feature.label === 'Type de bien'
);

const paramTypeVente = featureVente?.param as string;
const valueTypeVente = featureVente?.values.find((value) => value.label === typeVente)?.value;

const results = await search({
	category: CATEGORY.VENTES_IMMOBILIERES,
	sort_by: SORT_BY.PRICE,
	sort_order: SORT_ORDER.ASC,
	enums: {
		[paramTypeVente]: [valueTypeVente],
	},
	locations: ['Paris'],
	price_min: 50000,
	price_max: 100000,
});

2. Recherche de consoles Atari neuve entre 30 et 60 euros

import { CATEGORY, SORT_BY, SORT_ORDER, search } from 'leboncoin-api-search';

const results = await search({
	keywords: 'Atari',
	only_title: true,
	category: CATEGORY.CONSOLES,
	sort_by: SORT_BY.TIME,
	sort_order: SORT_ORDER.DESC,
	enums: {
		item_condition: ['1'],
	},
	price_min: 30,
	price_max: 60,
});

3. Récupérer les 1000 premières annonces de chats

import { CATEGORY, searchMultiples } from 'leboncoin-api-search';

const results = await searchMultiples(
	{
		category: CATEGORY.ANIMAUX,
		keywords: 'Chat',
		limit: 100,
	},
	10,
);

Avancé

  1. Pleins d'informations sur les filtres, catégories, recherches, etc. sont disponibles dans le fichier src/constants.ts.
  2. Les test E2E sont ne sont pas exécutés avec Jest car ça déclenchait un CAPTCHA sur le site. Ils sont donc exécutés manuellement.