问题
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?
回答1:
The YouTube API v3 returns data in JSon. It is not possible to change it to return xml.
Prerequisites
- Register your application with Google so that it can submit API requests.
- Familiarize yourself with the core concepts of the JSON (JavaScript
Object Notation) data format. For more information, see json.org.
来源:https://stackoverflow.com/questions/30153111/how-to-get-an-xml-response-from-the-googleapi-youtube-api