Wikipedia API: search for famous people

前端 未结 4 1613
醉话见心
醉话见心 2021-02-20 01:41

I have the following Wikipedia API search query:

http://en.wikipedia.org/w/api.php?&action=query&generator=search&gsrnamespace=0&gsrlimit=20&prop=pag

4条回答
  •  梦毁少年i
    2021-02-20 02:23

    There is two urls to search famous peoples :

    https://en.wikipedia.org/w/api.php?action=query&generator=search&format=json&exintro&exsentences=1&exlimit=max&gsrlimit=20&gsrsearch=hastemplate:Birth_date_and_age+Melanie_laurent&pithumbsize=100&pilimit=max&prop=pageimages%7Cextracts
    https://en.wikipedia.org/w/api.php?action=query&generator=search&format=json&exintro&exsentences=1&exlimit=max&gsrlimit=20&gsrsearch=hastemplate:Birth_date+Melanie_laurent&pithumbsize=100&pilimit=max&prop=pageimages%7Cextracts
    

    The only difference between both url is gsrsearch parameter :

    To get people alive you have to use hastemplate:Birth_date_and_age

    To get dead people you have to use hastemplate:Birth_date

    In my case, i have to do two requests.

    In this example url, juste replace Melanie_laurent by your query.

提交回复
热议问题