【发布时间】:2021-01-01 14:15:17
【问题描述】:
我正在使用 wikipedia api 来获取与关键字相关的图像
例如http://en.wikipedia.org/w/api.php?action=opensearch&format=xml&search=mozart&origin=* 正在向我返回数据,我可以从那里提取图像。
将格式更改为jsonhttp://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 来获取与关键字相关的图像
【问题讨论】:
标签: wikipedia-api