维基百科api opensearch无法使用 json

问题描述

我正在使用Wikipedia api来获取关键字的相关图片

例如http://en.wikipedia.org/w/api.php?action=opensearch&format=xml&search=mozart&origin= *向我返回数据,我可以从那里提取图像。

将格式更改为json http://en.wikipedia.org/w/api.php?action=opensearch&format=json&search=mozart&origin= *我有一个奇怪的结果

[
    "mozart",[
        "Mozart","Mozart and scatology","Mozart in the Jungle","Mozart,l'opéra rock","Mozart effect","Mozart family grand tour","Mozart in Italy","Mozart's nationality","Mozart La Para","Mozarteum University Salzburg"
    ],[
        "","",""
    ],[
        "https://en.wikipedia.org/wiki/Mozart","https://en.wikipedia.org/wiki/Mozart_and_scatology","https://en.wikipedia.org/wiki/Mozart_in_the_Jungle","https://en.wikipedia.org/wiki/Mozart,_l%27op%C3%A9ra_rock","https://en.wikipedia.org/wiki/Mozart_effect","https://en.wikipedia.org/wiki/Mozart_family_grand_tour","https://en.wikipedia.org/wiki/Mozart_in_Italy","https://en.wikipedia.org/wiki/Mozart%27s_nationality","https://en.wikipedia.org/wiki/Mozart_La_Para","https://en.wikipedia.org/wiki/Mozarteum_University_Salzburg"
    ]
]

与xml格式不是完全相同。

我知道将xml转换为json并不是很复杂,但是我想了解为什么我无法获得正确的输出。

我想知道您是否有更好的API来获取与关键字相关的图片

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)