博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
带有userstack的惊人用户代理API
阅读量:2514 次
发布时间:2019-05-11

本文共 3877 字,大约阅读时间需要 12 分钟。

We do our best to design and code websites so that they look and perform the way they should regardless of device or browser, but the truth is we sometimes we need to code for specific device, browser, or crawler. Whether it's a quick hack or a simply wanting to display different content for a given device, you eventually need that information. apilayer has created an amazing api, , to help you!

我们会尽力设计和编码网站,以便无论使用何种设备或浏览器,它们的外观和执行方式均应如此,但事实是有时我们需要为特定的设备,浏览器或搜寻器编码。 无论是快速入侵还是只是想为给定设备显示不同的内容,您最终都需要该信息。 apilayer创建了一个了不起的api 来帮助您!

userstack animation

快速点击 (Quick Hits)

  • All you need to do is provide the user agent to get a detailed summary of the user's device

    您需要做的就是提供用户代理以获取用户设备的详细摘要。
  • The is free to use

    是免费使用的

  • Supports multiple output formats (json and xml)

    支持多种输出格式(json和xml)
  • Provides bulk lookup as well as single lookup

    提供批量查找以及单次查找
  • Trusted by ZenDesk, Amazon, Apple, and Lyft

    受到ZenDesk,Amazon,Apple和Lyft的信任
  • Created by , creators of other amazing APIs like , , , and more

    由创建,其他令人惊叹的API的创建者,例如 , , 等

使用用户栈 (Using userstack)

Start by signing up for your . Once you have your API key, you can start using the simple but very useful userstack API.

首先 。 拥有API密钥后,就可以开始使用简单但非常有用的用户堆栈API。

All you need to do is send the API key and user agent to the endpoint and you'll get a logical, informative object that describes the user device, browser, and more:

您所需要做的就是将API密钥和用户代理发送到端点,您将获得一个逻辑丰富的对象,该对象描述用户设备,浏览器等:

curl https://api.userstack.com/api/detect    ?access_key=MY_API_KEY    &ua=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3672.0 Safari/537.36
{     "ua":"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/73.0.3672.0 Safari\/537.36",   "type":"browser",   "brand":"Apple",   "name":"Mac",   "url":"https:\/\/www.google.com\/about\/company\/",   "os":{        "name":"macOS 10.14 Mojave",      "code":"macos_10_14",      "url":"https:\/\/en.wikipedia.org\/wiki\/MacOS_Mojave",      "family":"macOS",      "family_code":"macos",      "family_vendor":"Apple Inc.",      "icon":"https:\/\/assets.userstack.com\/icon\/os\/macosx.png",      "icon_large":"https:\/\/assets.userstack.com\/icon\/os\/macosx_big.png"   },   "device":{        "is_mobile_device":false,      "type":"desktop",      "brand":"Apple",      "brand_code":"apple",      "brand_url":"http:\/\/www.apple.com\/",      "name":"Mac"   },   "browser":{        "name":"Chrome",      "version":"73.0.3672.0",      "version_major":"73",      "engine":"WebKit\/Blink"   },   "crawler":{        "is_crawler":false,      "category":null,      "last_seen":null   }}

The returned object provides a wealth of information, parsed and placed into logical sections:

返回的对象提供了大量信息,这些信息已解析并放入逻辑部分:

  • device: is_mobile_device is a very useful property to incorporate for your design layouts

    deviceis_mobile_device是一个非常有用的属性,可用于您的设计布局

  • browser: providing version information

    browser :提供版本信息

  • crawler: lets you know if it's a webcrawer or bot, and which bot you are

    crawler :让您知道它是网络爬虫还是机器人,以及您是哪个机器人

You can provide additional parameters to specify just the information you want returned from the API:

您可以提供其他参数以仅指定要从API返回的信息:

curl https://api.userstack.com/api/detect    ?access_key=MY_API_KEY    &ua=...    &fields=device,browser.version

Like other apilayer APIs, userstack allows you to use JSONP:

像其他apilayer API一样,userstack允许您使用JSONP:

curl https://api.userstack.com/api/detect    ?access_key=MY_API_KEY    &ua=...    &callback=MY_FUNCTION_NAME

What I love about apilayer APIs is that they're always simple to use and were constructed for a very specific purpose. What provides is so useful and I can trust it to be accurate and maintained. Give userstack a look -- it's worth your time to get accurate, usable useragent information!

我喜欢apilayer API的原因在于它们总是易于使用,并且是为特定目的而构造的。 用户提供的功能非常有用,我可以相信它是准确的并可以维护。 让用户看一下-值得您花费时间获取准确,可用的用户代理信息!

翻译自:

转载地址:http://jvpwd.baihongyu.com/

你可能感兴趣的文章
springmvc 访问时找不到配置文件
查看>>
采访吴岳师兄有感 by 王宇飞
查看>>
LVS简略介绍
查看>>
hdu 1021 Fibonacci Again
查看>>
JVM架构_XmnXmsXmxXss有什么区别:转
查看>>
PHPExcel 使用心得
查看>>
洛谷 P3374 【模板】树状数组 1(单点加,区间和)
查看>>
verilog 代码编写小记
查看>>
PyQT的安装和配置
查看>>
从 docker 到 runC
查看>>
守护进程
查看>>
第十二周作业
查看>>
php数组
查看>>
Linux 防火墙
查看>>
互联网金融P2P主业务场景自动化测试
查看>>
array_filter函数的应用
查看>>
梅西确定代言 中国首秀牵手Mate 8
查看>>
html,body
查看>>
一个Brushes笔画应用ios源码完整版
查看>>
IOS 网络浅析-(七 JSON解析之三方JSONKit)
查看>>