我正在使用 P5.JS 尝试显示来自 MediaWiki API 的文本。
这是 api url,我使用 https://en.wikipedia.org/w/api.php?action=parse&page=List_of_death_row_inmates_in_the_United_States&format=json§ion=20&prop=text
我需要 data.parse.wikitext.* 中的文本。* 但是,当使用星号时,它会抛出一个错误,指出“意外的标记*”。我尝试过使用引号,但没有成功。
我可以使用 data.parse.wikitext 显示对象,但无法访问特定文本。
同样的逻辑也适用于此链接:https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&redirects=1&titles=https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro&explaintext&redirects=1&titles=Death_row我试图获取提取文本,但在使用 JSON 路径 requests.pages.20786828.extract 时出现错误,因为它不喜欢整数。
谢谢
最佳答案
关于javascript - 加载路径中包含字符串或 astrix 的 JSON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53696178/