zxol / airbnbapi Goto Github PK
View Code? Open in Web Editor NEWUnofficial airbnb.com REST API wrapper for node.js
License: MIT License
Unofficial airbnb.com REST API wrapper for node.js
License: MIT License
A GET to /v2/reviews
with the following parameters:
{
_format: "for_web_host_stats",
_offset: offset,
_limit: limit,
_order: "recent",
role: "guest",
"reviewee_id": user_id
}
Returns the reviews with pretty much all info. Role can be "host" to return all the reviews made by the hosts for that person.
Your own user_id can be deduced by get_host_summary['active_listings'].first['listing']['listing']['user_id']
. Yuck. Whatever, I saved it as a constant and hardwired it, it's good enough for my use case.
As I need a specialist for AirBnB API integration with our current system I would like to know if an expert can help to finalize our project
Thanks
Line 9 in 3ff8075
There debug
should also be added in that line, right?
I try to get a token with:
let token = airbnb.newAccessToken({username:'user', password:'password'})
and I get this error msg:
{ error_code: 420,
error: 'unknown_error',
error_message: 'Unable to perform action. Please try again through the website or contact support if you need immediate assistance.',
client_error_info:
{ airlock:
{ action_name: 'account_login',
completion_redirect_url: '',
error_redirect_url: '',
escapable: true,
fallback_friction: 'contact_us_form',
first_name: 'xxxxx',
flow: 'captcha_flow',
friction_data: [Object],
header_text: 'Please verify yourself',
id: 12345678,
identifier: null,
keep_webview_open_on_redirect: false,
redux: true,
status: 0,
should_replay_request: true,
user_id: 876654321,
user_message: null },
metadata: {} } }
I would like to import SDK
var airbnb = require('airbnbapijs')
I do not see any component like airbnbapijs
. Shouldn't it exist to be import into my web app?
Hi there,
Could additional usage examples be included in the README for people not familiar with JS? I am coming from Python, so I am unsure exactly how to use promises
. Unfortunately, I am having trouble with the basic task of printing the data from the promises to the console.
This repo seems to be one of the only viable methods to get the Airbnb data I need. Python alternatives are not great.
Currently, the library does not have adequate error reporting.
When I initially wrote this library, it was part of a project that used a simple null check to essentially ignore errors. Quite daft, I know. :/
So I think I will need to make some serious changes to the API. I will change it to return a rejected promise with a JS Error object. It will contain either a wrapper level error (i.e. a missing argument) or a error response from airbnb (for example, "listing not found", or "you must be authorized to do that")
I am trying to download all listings for Georgia, if i set location: 'Georgia, GE',
which seems to work, the offset: 500
, brings an empty list already. Any idea how to get all listings without looping through towns?
Thanks for awesome project!!
The listing search endpoint/function is missing some options. It should be updated with the full suite of options.
I find set setAvailabilityForDay does not work but setPriceForDay is ok.
> var setav;
undefined
> airbnb.setAvailabilityForDay({
... id: 27836280,
... date: '2019-07-29',
... availability: 'blocked' // or 'blocked'?
... }).then( v => { setav = v } ) .catch( e => { console.log(e) } )
Promise {
<pending>,
domain:
Domain {
domain: null,
_events:
[Object: null prototype] {
removeListener: [Function: updateExceptionCapture],
newListener: [Function: updateExceptionCapture],
error: [Function: debugDomainError] },
_eventsCount: 3,
_maxListeners: undefined,
members: [],
[Symbol(kWeak)]: WeakReference {} } }
>
> setav
undefined
i.e
airbnb.setConfig({
userAgent: "Mozilla 5",
defaultToken: "s0fd9fuf8we0j0F98jfJSd99"
})
Hi,
with get all reservations, I am getting 403 forbidden for _format=for_mobile_host
_format=for_mobile_guest is working well.
Did Airbnb change the API?
Thanks
Petr
Is the returned .metadata.listings_count value representing the number of results found? I can't find any other field that is providing a count.
Assuming #1 is correct, when there are a lot of results (>350), I observed that only the first 350 listings returned is unique (this is involving incrementing the offset at each iteration by 50). If you try to get more after that the results are just a duplicate of what was previously returned.
It seems the website started using the V3 of the API which seems to be a GraphQL API.
Has anyone tried accessing that API? Has anyone had success authenticating to it? If yes, then all our troubles around finding the correct formats, api endpoints go away, since graphql is more or less self-documenting.
Hey guys,
This library looks really good, and I'm very much considering using it!
But before doing so, I'm wondering if anyone ever got airbnb's side on whether or not using their unofficial API goes against their terms of services? I would appreciate anyone's insights on this.
While most of the functions this API provide are based on Primary Host, right? For example, the function, will only return the Listings which hosted by the token authorized user. What if there are listings that co-hosted by the user, is there any route we could use to get the limited version of information which is provided to the co-host?
Some endpoints accept a locale option that adds some translated info and changes the currency. Lets implement an option for each endpoint and a default option.
I tried preapprove for v1 api, it seems like not working
Hi,
I am trying to get token for airbnb and it returning null in response. Here is the code I am using
airbnb.login({ username: 'xxxxx', password: 'xxxxx }).then(function(data) { console.log('data: ', data); })
It returning null in console.
airbnb.newAccessToken({ username: 'xxxxxx', password: 'xxxxxx' }).then(function(data) { console.log('data: ', data); })
Above code returning error:-
data: { error: { error_code: 420, error: 'unknown_error', error_message: 'Unable to perform action. Please try again through the website or contact support if you need immediate assistance.' } }
Please help me and let me know where I am doing wrong.
Is it possible to get an API endpoint to disable (unlist) and relist listings?
buildOptions defaults currency to JPY
:
buildOptions({
token,
method = 'GET',
route = '/v2/batch',
uri,
json = true,
headers,
currency = 'JPY',
format,
qs,
body,
timeout,
proxy
})
Even if you use airbnb.setCurrency('USD');
or airbnb.setConfig({ currency: 'USD' });
the requests are being sent with qs.currency: 'JPY'
unless specifically set in the method. So e.g. if you ping getOwnListings
, you'll get all prices in JPY
currency.
Maybe add something in buildOptions
to respect the config, instead of the default values there.
I'm having trouble sending a message to a thread (POST /v2/messages
), returning a 404:
{"error_code":404,"error_type":"invalid_action","error_message":"Action not found.","error_id":"27d129c058199e4fdeea1d9d76ea90a9"}
Is anyone else seeing the same error?
Copied from the readme
var airbnb = require('airbnbapijs');
(async () => {
var list = await airbnb.listingSearch({
location: 'Akihabara, Tokyo',
checkin: '2020-01-21',
checkout: '2020-02-10',
offset: 0,
limit: 20,
language: 'en-US',
currency: 'USD',
guests: 6, // Number of guests for price quote
instantBook: true, // only list instant bookable listings.
minBathrooms: 0,
minBedrooms: 2,
minBeds: 6,
minPrice: 0,
maxPrice: 0,
superhost: true,
amenities: [1, 2, 4, 23], // array of IDs.
hostLanguages: [1, 3, 6], // array of IDs.
keywords: 'ocean view,garden,quiet', //comma separated
roomTypes: ['Entire home/apt', 'Private room', 'Shared room'],
neighborhoods: ['westside', 'riverside'],
minPicCount: 4,
sortDirection: 1 // 1 = forward, 0 = reverse
});
console.log(list); //undefined
})().catch(err => {
console.error(err);
});
list is undefined
Does anyone have information on the number of requests allowed per time period?
Hi,
Im using Smartbnb and Tokeet for two months now. I've seen some common characteristics on them, I think they have no real API integration. Maybe we could learn something about Airbnb API from their login process.
When you register your Airbnb account. You should go to an Airbnb page and make a Captcha verification.
Smartbnb makes updates every 30 seconds.
am I missing something? this seems like one of the most important filters when searching for listings.. nearly all filters are available but I can't find how to set the date range.. I mean.. if I want to see listings available between June 1st and June 30th for example.
Also would be lovely to add the "rental type" filter.. eg 'shared room', 'full apartment', etc
Thanks a lot for your contribution! Looking forward to future updates
airbnb.login({ username: "email", password: "password" })
.then(res => console.log(res))
// null
I don't know much about node.js. I want to request airbnb's API via pytyon. Where can I find the airbnb api documentation?thanks
For use cases where the library is used with a single account, having to supply the same token for every call is redundant.
Including a .setDefaultToken(token)
method would solve this.
The getReservations() and getReservationsBatch() functions only seems to return results for the primary host. Is there a way to get the results for cohosted listings?
Anyone figured out how to get Experience/Adventure listing details?
I've experimented with v1 and v2 paths.
Hi guys, I am really new in this. I have to tried to request the calendar but I get this error
error_code: 401,
error: 'authentication_required',
error_message: 'Please login to continue.'
My token is correct because I can call to other functions.
i know login broke long time ago but i used to be able to search at least. now the search is empty always
I am getting the following destructure error on getOwnListings method
var ol = airbnb.getOwnListings().then( v => { console.log(v) } ) .catch( e => { console.log(e) } )
undefined
TypeError: Cannot destructure propertytoken
of 'undefined' or 'null'.
at AirApi.getOwnListings (C:\mynode\node_modules\airbnbapijs\build\main.js:415:25)
at repl:1:17
at Script.runInThisContext (vm.js:122:20)
at REPLServer.defaultEval (repl.js:332:29)
at bound (domain.js:402:14)
at REPLServer.runBound [as eval] (domain.js:415:12)
at REPLServer.onLine (repl.js:642:10)
at REPLServer.emit (events.js:203:15)
at REPLServer.EventEmitter.emit (domain.js:448:20)
at REPLServer.Interface._onLine (readline.js:308:10)
at REPLServer.Interface._line (readline.js:656:8)
at REPLServer.Interface._ttyWrite (readline.js:937:14)
at REPLServer.self._ttyWrite (repl.js:715:7)
at ReadStream.onkeypress (readline.js:184:10)
at ReadStream.emit (events.js:198:13)
at ReadStream.EventEmitter.emit (domain.js:448:20)
at emitKeys (internal/readline.js:424:14)
at emitKeys.next ()
at ReadStream.onData (readline.js:1075:36)
at ReadStream.emit (events.js:198:13)
at ReadStream.EventEmitter.emit (domain.js:448:20)
at addChunk (_stream_readable.js:288:12)
On the issue of giving each endpoint it's own file.
Pros:
Cons:
I feel this would be a good thing to do before 1.0 version is released.
I have tried multiple different ways now, but I cannot get
airbnb.getPublicListingCalendar({
id: 109834757,
month: 1,
year: 2018,
count: 1
})
to work. Does this work for anyone else? Any help is much appreciated. Thanks.
The following statement in the project description has scared me away from this project until now:
"(Ab)using it could result in an account ban"
var airbnb = require('airbnbapijs');
airbnb.newAccessToken({ username: '[email protected]', password: 'xxxx' }).then(
x =>
console.log(x)
);
Access Denied
Right now we are able to get only the active listing.
It would be usefull to have an option like isActive to get also non-active listing
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.