Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: image of item, creature etc. #75

Open
biaggio12 opened this issue Jun 17, 2020 · 4 comments
Open

Feature: image of item, creature etc. #75

biaggio12 opened this issue Jun 17, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@biaggio12
Copy link

Hey, so far i'm loving the API. Easy and simple to use, but it's missing one feature.
I'm not an expert but as far as it's possible would be great if you add the image URL in responses on the creatures and items etc. Would be really usefull

@benjaminkomen benjaminkomen added the enhancement New feature or request label Jun 17, 2020
@benjaminkomen
Copy link
Owner

Hi!
Glad you like it!

Which image URL would you prefer to have? Let's take a creature, say a dragon for example. We could add an imageUrl field which could hold https://tibia.fandom.com/wiki/File:Dragon.gif, but that is something we can simply derive from the name attribute (because images of 'things' in TibiaWiki are always structured as 'File:{PAGENAME}.gif' and the page name is in the name field).

But I can imagine you want a direct URL to the image, e.g. https://vignette.wikia.nocookie.net/tibia/images/e/e0/Dragon.gif/revision/latest?cb=20140823213526&path-prefix=en

I think this URL is a bit more dynamic and can change over time, maybe also differ per region you access TibiaWiki from.

@biaggio12
Copy link
Author

Hmm, that's actually kinda pain in the ass. Yea i'd like to have direct URL to img like the second one you posted. I wonder how dynamic it is. I think the URL is changing each time someone edits the article but i'm not really sure. Well if that's gonna help you somehow then i don't think this URL depends on region of access. The URL u sent here is working perfectly fine for me. (I'm accessing it from Poland. )

@benjaminkomen
Copy link
Owner

Ok, well, let's see what I can do, I think it might be obtainable using the MediaWiki API and if not, we'll just have to be a bit more creative :)

@benjaminkomen
Copy link
Owner

Ok, the MediaWiki API does support this, e.g.: https://tibia.fandom.com/api.php?action=query&titles=File%3ADragon.gif&prop=imageinfo&iilimit=50&iiend=2007-12-31T23%3A59%3A59Z&iiprop=timestamp%7Cuser%7Curl&format=json results in:

{
  "query": {
    "pages": {
      "1317": {
        "pageid": 1317,
        "ns": 6,
        "title": "File:Dragon.gif",
        "imagerepository": "local",
        "imageinfo": [
          {
            "timestamp": "2014-08-23T21:35:26Z",
            "user": "Kapitan Kuna",
            "url": "https://vignette.wikia.nocookie.net/tibia/images/e/e0/Dragon.gif/revision/latest?cb=20140823213526&path-prefix=en",
            "descriptionurl": "https://tibia.fandom.com/wiki/File:Dragon.gif"
          }
        ]
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants