Giter VIP home page Giter VIP logo

willhaben's Introduction

Willhaben API

This module has only tested on https://willhaben.at!

Documentation

There are two ways you can use this API. Either by entering the URL and let the API extract all the results or by using the builder to build the URL and let the API extract the results.

Extract results directly from URL

For this method you need an URL of the willhaben search you want to make. Then you use the .getListings(URL) function and it returns a promise which resolves to an array with all the results.

Example

This example searches for rtx in the Grafikkarten category and will show the first 1000 results.

const willhaben = require('willhaben')

willhaben.getListings('https://www.willhaben.at/iad/kaufen-und-verkaufen/marktplatz/pc-komponenten/-5882?keyword=rtx&rows=1000').then(json => {
    console.log(json)
})

Use builder to build URL and get results

The URL builder is obtainable with the .new() function. Then you can use various methods on the object and execute the search with .search(). This method returns a promise which resolves to an array containing all the results.

Available methods in the builder:

Method Description
.category(int) sets the category to search (default: all)
.condition(int) adds a condition to search
.transferType(int) adds a transfer type to search
.count(int) sets the count of how many results should be searched for
.paylivery(boolean) sets if you should search for PayLivery
.keyword(string) sets the keyword to search for (basically a text search)
.getURL() get URL with the currently set variables
.search() executes search -> returns Promise

Getting constants There are constants for the categories, conditions, and transfer types. The contants are saved as properties of the module object. Example:

const willhaben = require('willhaben')

console.log(willhaben.getCategories.grafikkarten)
Property Constant Description
.getCategories get the integer for a category
.getConditions get the integer for a condition
.getTransferTypes get the integer for a transfer type
Example

This example searches for rtx in the Grafikkarten category and will show the first 1000 results. (same example as above)

const willhaben = require('willhaben')

willhaben.new()
    .keyword('rtx')
    .count(1000) // default is 1000
    .category(willhaben.getCategories.grafikkarten)
    .search().then(json => {
        console.log(json)
    })

willhaben's People

Contributors

cproschek avatar cp02a avatar

Stargazers

 avatar  avatar Kevin avatar  avatar  avatar lstransky avatar  avatar David Lopez Jr. avatar Mario Kandut avatar athomschke avatar Mark Koestenberger avatar Dominik Nußbaumer avatar Fabian Hofmann avatar  avatar yahya jabary avatar Alp Zafer avatar David avatar Jenby32 avatar  avatar Jan  avatar  avatar  avatar nmolina avatar Maximilian Jellen avatar  avatar  avatar Bence Czufor avatar  avatar  avatar  avatar Tintifax avatar Oliver Streißelberger avatar Daniel Weidinger avatar __olıvег__ avatar

Watchers

 avatar __olıvег__ avatar Lukas Reithofer avatar

willhaben's Issues

[improvement] Kategorie Scaper

Wäre es möglich einen "Scraper" zum Fetchen der Stammdatenkataloge bereitzustellen?
Scheinbar änderten sich die IDs über die Zeit.

Ich versuchte mühsam über den Quellcode, die Bundeslands/Ortsuche zu implementieren.
Aber bei den Kategorien komme ich nicht weiter, da leider nie alle gleichzeitig geladen werden,...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.