-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
page.mainImage() throws error if querying in another language #51
Comments
Good find! Will fix this. |
Fixed in v3.1.2 |
Thanks, that was quick. |
Hmm... Can you make a new issue with more information for me. Code examples that don't work. And an error? |
Sure:
Output:
Same call with fr.wikipedia.org will return
|
Okay. So I looked into this issue. The problem is that the German version of the Batman page does not have a Infobox. The infobox tells us which image is the "main image". What I will do for now, until we have a better fix, is just return the first image if there is no infobox data. |
Okay, check v3.1.3 |
Now I get an image 👍 But even though the page has an infobox, it's not the main image. In the German version the property is called "bildname" as opposed to "image" in English and French. I check also Spanish, where it's "imagen". You can test it for example by searching for "Cristiano Ronaldo".
Would something like this be possible? (EN/FR, DE, ES, IT for now) |
Oh, and in the case of the fallback it returns the whole imageInfo object, not just the URL.
|
Okay, I added the different translations of "image", but I don't like returning different types. |
Check v3.1.4 ~ The π version 👍 |
The problem seems to be that for example in the German version (https://de.wikipedia.org/w/api.php), the prefix is not "File:" but "Datei:", in the French version it's "Fichier:". For example:
Should be possible to split by indexOf(':')?
The text was updated successfully, but these errors were encountered: