简体   繁体   English

Airbnb短链接到完整链接

[英]Airbnb short link to full link

I'm working on an app that references and uses Airbnb links as input.我正在开发一个引用并使用 Airbnb 链接作为输入的应用程序。 There are 2 types I've found:我发现有两种类型:

  1. Long form, eg: https://www.airbnb.com/rooms/47074377 This is what people use from desktop.长格式,例如: https://www.airbnb.com/rooms/47074377这是人们从桌面使用的。
  2. Short form, eg: https://abnb.me/YEO24YyMisb .缩写形式,例如: https://abnb.me/YEO24YyMisb These are often what people share from mobile devices.这些通常是人们通过移动设备共享的内容。

My javascript code can handle (1) just fine because I can easily find the substring of the last slash after "rooms" in order to get the PropertyID = 47074377 and make subsequent API calls.我的 javascript 代码可以处理(1)就好了,因为我可以很容易地找到“房间”之后最后一个斜杠的 substring,以便获取 PropertyID = 47074377 并进行后续的 ZDB974238714CA8DE634A7CE1D083A1 调用。

But I cannot figure out how to get the propertyID from (2).但我无法弄清楚如何从 (2) 中获取 propertyID。 I need this ID in order to make API calls.我需要这个 ID 才能进行 API 调用。

Anyone have suggestions?有人有建议吗?

From @c0mit1 -- https://unshorten.me/api this worked.从@c0mit1 -- https://unshorten.me/api这工作。 Simply call this with the API you want to unshorten.只需使用您想要取消缩短的 API 来调用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM