I am attempting to retrieve box art for video game titles from Wikipedia using a GET query and the Wikipedia API. I am using the below query string which seems to be working fine for any other article, such as for the article about the Wii:
https://en.wikipedia.org/w/api.php?action=query&titles=Wii&prop=pageimages&pithumbsize=400&format=json&formatversion=2
Which produces the below result:
{
"batchcomplete": true,
"query": {
"pages": [
{
"pageid": 421853,
"ns": 0,
"title": "Wii",
"thumbnail": {
"source": "https://upload.wikimedia.org/wikipedia/commons/thumb/1/14/Wii-console.jpg/400px-Wii-console.jpg",
"width": 400,
"height": 400
},
"pageimage": "Wii-console.jpg"
}
]
}
}
However whenever I try it with any article about an individual video game title it isn't working. For example, for Wii Sports:
https://en.wikipedia.org/w/api.php?action=query&titles=Wii_Sports&prop=pageimages&pithumbsize=400&format=json&formatversion=2
Which produces the below:
{
"batchcomplete": true,
"query": {
"normalized": [
{
"fromencoded": false,
"from": "Wii_Sports",
"to": "Wii Sports"
}
],
"pages": [
{
"pageid": 5077457,
"ns": 0,
"title": "Wii Sports"
}
]
}
}
Every other title I try is bringing up the same results.
Is there any way to resolve this?
I believe you will only get image results when the image is free in the public domain or licensed in such a way that it is free to use and not when it is licensed or fair use.
When I query for pageprops
on wii, I see a page_image_free
and indeed, the image on that page is in the public domain. However, on wii sports, it instead has page_image
which means the license is not free, and indeed the image on that page is fair use which means it's not licensed or free.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With