如何从带有标题和主图像的类别中获取所有维基百科页面?

How to get all Wikipedia pages from category with title and primary image?

我想列出类别中带有标题和主图像的所有页面。

我现在的APIurl是这样的:

https://en.wikipedia.org/w/api.php?action=query&cmlimit=100&list=categorymembers&cmtitle=Category%3AAmerican%20male%20film%20actors

结果如下:

....
{
    "pageid": 3600962,
    "ns": 0,
    "title": "Lee Aaker"
},
....

我不知道正确的参数来获得这样的响应:

{
   "pageid": 3600962,
   "ns": 0,
   "title": "Lee Aaker",
   "thumbnail": {
       "original": "https://upload.wikimedia.org/wikipedia/some_image_path.jpg"
    }
}

您可以使用 categorymembers in combination with pageimages:

https://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmlimit=100&gcmtitle=Category:American male film actors&prop=pageimages&pilimit=100
  • 类别成员 参数:gcmtitle=Category:American male film actorsgcmlimit=100
  • pageimages 参数:pilimit=100