Google Feed Loader API ignoring XML attributes

≯℡__Kan透↙ 提交于 2019-11-29 08:43:52

The 'enclosure' tag is not included in the JSON response, so you have two options setting the output argument:

You need to set the output to 'XML': https://developers.google.com/feed/v1/jsondevguide#json_args

url = 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&output=xml&num=10&callback=?&q='+ encodeURIComponent(url); 

Or use the mixed format: https://developers.google.com/feed/v1/devguide#resultMixed

url = 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&output=json_xml&num=10&callback=?&q='+ encodeURIComponent(url); 

You´ll get the JSON plus a a new xmlString property with all the tags (including 'enclosure' attributes)

alert(d.responseData.xmlString);

In both cases you need to parse the XML string and navigate to the needed info

Hope this helps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!