对非官方 Pandora API 进行 JSON 调用 [英] Making JSON calls to Unoffical Pandora API

查看:35
本文介绍了对非官方 Pandora API 进行 JSON 调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我在工作时听 Pandora,然后想,伙计,如果能得到 Pandora 的电台列表,或者以某种身份远程与它互动,那真是太酷了.

So I was listening to Pandora at work, and was like, Man, it would be really cool to get the station list of Pandora, or interact with it remotely in some capacity..

所以我发现了这个非官方的 Pandora API,它只返回一堆看起来非常有用和整洁的 JSON 对象!这是 API 的链接:http://pan-do-ra-api.wikia.com/wiki/Json/5

So I found this unofficial Pandora API which just returns a bunch of JSON objects which look pretty helpful and neat! Here is the link to the API: http://pan-do-ra-api.wikia.com/wiki/Json/5

问题是我从来没有真正使用过 JSON,也绝对没有使用过这个 API,所以我不知道如何去做.我认为,如果有人给我一个例子,说明如何从我的 Windows 7 台式计算机上获取电台列表,那将非常有帮助,我可能可以从那里获取其余内容.

The problem is I have never really used JSON and definitely never used this API so I am not sure how to go about doing things. I think that if someone gave me an example of how to say get the station list from my windows 7 desktop computer that would be really helpful and I could probably get the rest from there.

谢谢!

推荐答案

同样,对于 Marc B 的评论,我有点同意.但是,更笼统地回答您的问题 - 这可能不值得您花时间.

Again, with the comments from Marc B, I somewhat agree. However, to more generically answer your question- it's probably not worth your time.

Pandora 请求/响应正文均通过 HTTP/HTTPS 发送.但是,它们都是加密的.有一个可用于加密和解密响应的公共"密钥列表.一旦你把所有这些都整理出来,你就必须使用 API.

Pandora request / response bodies are all sent over HTTP/HTTPS. However, they are all encrypted. There is a "public" list of keys you can use to encrypt and decrypt the responses. Once you have sorted all of that out, you'll have to use the APIs.

首先,您必须对用户进行身份验证以获取 Auth 令牌.从那里,您可以访问需要身份验证令牌的 API.

First you have to authenticate the user to get an Auth token. From there, you can access the APIs which require the auth tokens.

最后一点,JSON 接口有很多不同的工作方式.有时 API 是通过 URL 本身指定的,例如http://example.com/json/foo

To your final point, JSON interfaces work in lots of different ways. Sometimes the API is specified through the URL itself like http://example.com/json/foo

其他时候,它是通过 POST 在请求正文中指定的.

Other times, it's specified in the request body through a POST.

如果你真的想弄清楚这一点,我会玩它.我怀疑有人会发布关于如何操作不是真正公开"的 API 的代码.Pandora 经常更改它以故意破坏第三方应用程序.

If you really want to figure this out, I would play with it. I doubt anybody will post code on how to manipulate an API that isn't really "public". Pandora changes it somewhat frequently to purposefully break third party applications.

一个简单的 JSON 示例:

A simple JSON example:

POST 到 http://example.com/json/foo

{ param: "val",
  anotherParam: "val",
  responseType: "XML" }

响应可能看起来像

{ status: 200,
  result: "you called the foo API" }

这篇关于对非官方 Pandora API 进行 JSON 调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆