'Grabbing image by specific suffix from mediawiki API queries
I'm querying the yugipedia media wiki to collect card images. I have no issues querying for the main image for each title query:
Will give me the main card image link for the Dark Magician page. However, the image I am trying to get to is the Legacy of Duelists image inside the image gallery related to Dark Magician. These cards all have the same suffix of LD-EN-VG.png so in the case of Dark Magician the file is named DarkMagician-LD-EN-VG.png
Is there any way to tailor the api query to only provide files with that specific suffix?
I can list all of the image urls in the gallery with:
But I'm stuck at filtering out just the LD-EN-VG.png query result. Trying to avoid using Python or Javascript to apply a regex to the queried JSON object and instead get it done with the API query itself.
Solution 1:[1]
You can put the name including the suffix for titles parameter.
I could not locate any image with the suffix 'LD-EN-VG,png' in the article 'Card Gallery:Dark Magician'. You wil get pageid as -1 in such cases for the query url. For an available file query, you will get the proper result.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | arjunaraoc |
