如何从googleapi Youtube API获取XML响应 [英] How to get an XML response from the googleapi Youtube API

查看:141
本文介绍了如何从googleapi Youtube API获取XML响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

YouTube似乎已将其API更新为新版API( YouTube数据API(v3) a>),突然间我的网站上的YouTube搜索无法正常工作。



我试图更新它们以使用新的API,但每次获得 JSON 结果时,而不是 XML ,旧的API返回了xml,所以我的代码需要一个xml返回结果。当我尝试在调用API时指定XML时,出现错误,表明调用无效。



任何人都可以向我解释如何检索XML来自YouTube API V3?

解决方案

YouTube API v3 会以 JSon 的形式返回数据。无法将其更改为返回xml。


先决条件


  1. 向Google注册您的应用程序以便它可以提交API请求。

  2. 熟悉JSON(JavaScript
    Object Notation)数据格式的核心概念。有关更多信息,
    请参阅 json.org



It seems that YouTube has updated their API to a newer one (YouTube Data API (v3)), and suddenly the YouTube searches on my site are not working.

I am trying to update them to work with the new API, but every time I get a JSON result, instead of XML, the old API returned xml so my code expects a xml return result. When I tried to specify XML in the call to the API, I got an error that the call is invalid.

Can anyone please explain to me how I can retrieve an XML from the YouTube API V3?

解决方案

The YouTube API v3 returns data in JSon. It is not possible to change it to return xml.

Prerequisites

  1. Register your application with Google so that it can submit API requests.
  2. Familiarize yourself with the core concepts of the JSON (JavaScript
    Object Notation) data format. For more information, see json.org.

这篇关于如何从googleapi Youtube API获取XML响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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