Accessing main picture of wikipedia page by API

前端 未结 14 1948
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 18:15

Is there any way I can access the thumbnail picture of any wikipedia page by using an API? I mean the image on the top right side in box. Is there any APIs for that?

14条回答
  •  离开以前
    2020-11-30 18:33

    Way 1: You can try some query like this:

    http://en.wikipedia.org/w/api.php?action=opensearch&limit=5&format=xml&search=italy&namespace=0

    in the response, you can see the Image tag.

    
    Italy national rugby union team
    
    The Italy national rugby union team represent the nation of Italy in the sport of rugby union.
    
    
    http://en.wikipedia.org/wiki/Italy_national_rugby_union_team
    
    
    
    

    Way 2: use query http://en.wikipedia.org/w/index.php?action=render&title=italy

    then you can get a raw html code, you can get the image use something like PHP Simple HTML DOM Parser http://simplehtmldom.sourceforge.net

    I have no time write it to you. just give you some advice, thanks.

提交回复
热议问题