Comments (4)
It's because they are using "Badge" instead of "image" in their wiki code... I can't believe there are so many different ways to label your main image. This is so frustrating...
from wiki.
Fixed in v4.3.3
from wiki.
I am sorry to tell you that I found more errors :/
Code:
var test = 879301; //you must replace this ID
wiki({apiUrl: 'https://de.wikipedia.org/w/api.php'})
.findById(test)
.then(page => {
console.log(page);
page.mainImage().then((img) => {
console.log(img);
});
});
{ raw:
{ pageid: 879301,
ns: 0,
title: 'FC Burnley',
contentmodel: 'wikitext',
pagelanguage: 'de',
pagelanguagehtmlcode: 'de',
pagelanguagedir: 'ltr',
touched: '2017-10-01T15:38:08Z',
lastrevid: 169252317,
length: 51942,
fullurl: 'https://de.wikipedia.org/wiki/FC_Burnley',
editurl: 'https://de.wikipedia.org/w/index.php?title=FC_Burnley&action=edit',
canonicalurl: 'https://de.wikipedia.org/wiki/FC_Burnley' },
html: [Function: html],
content: [Function: content],
summary: [Function: summary],
images: [Function: images],
references: [Function: references],
links: [Function: links],
categories: [Function: categories],
coordinates: [Function: coordinates],
info: [Function: q],
backlinks: [Function: backlinks],
rawImages: [Function: h],
mainImage: [Function: mainImage],
langlinks: [Function: langlinks],
rawInfo: [Function: p] }
https://upload.wikimedia.org/wikipedia/commons/e/e6/Flag_of_Slovakia.svg
{ raw:
{ pageid: 4484236,
ns: 0,
title: 'RB Leipzig',
contentmodel: 'wikitext',
pagelanguage: 'de',
pagelanguagehtmlcode: 'de',
pagelanguagedir: 'ltr',
touched: '2017-10-15T09:17:42Z',
lastrevid: 169992410,
length: 107305,
fullurl: 'https://de.wikipedia.org/wiki/RB_Leipzig',
editurl: 'https://de.wikipedia.org/w/index.php?title=RB_Leipzig&action=edit',
canonicalurl: 'https://de.wikipedia.org/wiki/RB_Leipzig' },
html: [Function: html],
content: [Function: content],
summary: [Function: summary],
images: [Function: images],
references: [Function: references],
links: [Function: links],
categories: [Function: categories],
coordinates: [Function: coordinates],
info: [Function: q],
backlinks: [Function: backlinks],
rawImages: [Function: h],
mainImage: [Function: mainImage],
langlinks: [Function: langlinks],
rawInfo: [Function: p] }
https://upload.wikimedia.org/wikipedia/commons/b/b4/Flag_of_Turkey.svg
{ raw:
{ pageid: 10023212,
ns: 0,
title: 'FC Bergheim',
contentmodel: 'wikitext',
pagelanguage: 'de',
pagelanguagehtmlcode: 'de',
pagelanguagedir: 'ltr',
touched: '2017-10-09T15:48:57Z',
lastrevid: 168583467,
length: 19376,
fullurl: 'https://de.wikipedia.org/wiki/FC_Bergheim',
editurl: 'https://de.wikipedia.org/w/index.php?title=FC_Bergheim&action=edit',
canonicalurl: 'https://de.wikipedia.org/wiki/FC_Bergheim' },
html: [Function: html],
content: [Function: content],
summary: [Function: summary],
images: [Function: images],
references: [Function: references],
links: [Function: links],
categories: [Function: categories],
coordinates: [Function: coordinates],
info: [Function: q],
backlinks: [Function: backlinks],
rawImages: [Function: h],
mainImage: [Function: mainImage],
langlinks: [Function: langlinks],
rawInfo: [Function: p] }
https://upload.wikimedia.org/wikipedia/de/6/63/%C3%96FB-Frauenliga_%28%C3%96sterreich%29_Logo.jpg
{ raw:
{ pageid: 6239591,
ns: 0,
title: 'SV Drochtersen/Assel',
contentmodel: 'wikitext',
pagelanguage: 'de',
pagelanguagehtmlcode: 'de',
pagelanguagedir: 'ltr',
touched: '2017-10-09T14:48:39Z',
lastrevid: 168662052,
length: 8187,
fullurl: 'https://de.wikipedia.org/wiki/SV_Drochtersen/Assel',
editurl: 'https://de.wikipedia.org/w/index.php?title=SV_Drochtersen/Assel&action=edit',
canonicalurl: 'https://de.wikipedia.org/wiki/SV_Drochtersen/Assel' },
html: [Function: html],
content: [Function: content],
summary: [Function: summary],
images: [Function: images],
references: [Function: references],
links: [Function: links],
categories: [Function: categories],
coordinates: [Function: coordinates],
info: [Function: q],
backlinks: [Function: backlinks],
rawImages: [Function: h],
mainImage: [Function: mainImage],
langlinks: [Function: langlinks],
rawInfo: [Function: p] }
https://upload.wikimedia.org/wikipedia/commons/f/f8/Flag_of_Macedonia.svg
from wiki.
Here are more, but this time I was on the english wikipedia
var test = 5747191;
wiki()
.findById(test)
.then(page => {
console.log(page);
page.mainImage().then((img) => {
console.log(img);
});
});
{ raw:
{ pageid: 5747191,
ns: 0,
title: 'Kosovo national football team',
contentmodel: 'wikitext',
pagelanguage: 'en',
pagelanguagehtmlcode: 'en',
pagelanguagedir: 'ltr',
touched: '2017-10-17T17:36:26Z',
lastrevid: 805591874,
length: 44707,
fullurl: 'https://en.wikipedia.org/wiki/Kosovo_national_football_team',
editurl: 'https://en.wikipedia.org/w/index.php?title=Kosovo_national_football_team&action=edit',
canonicalurl: 'https://en.wikipedia.org/wiki/Kosovo_national_football_team' },
html: [Function: html],
content: [Function: content],
summary: [Function: summary],
images: [Function: images],
references: [Function: references],
links: [Function: links],
categories: [Function: categories],
coordinates: [Function: coordinates],
info: [Function: q],
backlinks: [Function: backlinks],
rawImages: [Function: h],
mainImage: [Function: mainImage],
langlinks: [Function: langlinks],
rawInfo: [Function: p] }
https://upload.wikimedia.org/wikipedia/commons/f/f3/Flag_of_Switzerland.svg
{ raw:
{ pageid: 681862,
ns: 0,
title: 'Switzerland national football team',
contentmodel: 'wikitext',
pagelanguage: 'en',
pagelanguagehtmlcode: 'en',
pagelanguagedir: 'ltr',
touched: '2017-10-17T20:17:26Z',
lastrevid: 805814758,
length: 44472,
fullurl: 'https://en.wikipedia.org/wiki/Switzerland_national_football_team',
editurl: 'https://en.wikipedia.org/w/index.php?title=Switzerland_national_football_team&action=edit',
canonicalurl: 'https://en.wikipedia.org/wiki/Switzerland_national_football_team' },
html: [Function: html],
content: [Function: content],
summary: [Function: summary],
images: [Function: images],
references: [Function: references],
links: [Function: links],
categories: [Function: categories],
coordinates: [Function: coordinates],
info: [Function: q],
backlinks: [Function: backlinks],
rawImages: [Function: h],
mainImage: [Function: mainImage],
langlinks: [Function: langlinks],
rawInfo: [Function: p] }
https://upload.wikimedia.org/wikipedia/commons/4/49/Flag_of_Ukraine.svg
from wiki.
Related Issues (20)
- page.title does not work HOT 1
- Page#content returns an empty array [] on Fandom Wiki HOT 1
- error TS2339: Property 'rawContent' does not exist on type 'Page'. HOT 2
- Issue viewing tables / Infoboxes HOT 2
- mainImage does not work for fr.wikipedia.org HOT 2
- mainImage fails "Invalid attempt to destructure non-iterable instance" on some specific pages HOT 2
- GeoSearch Radius is not in kilometers but in meters HOT 1
- Is it possible to chain requests? HOT 4
- wiki.search returns TypeError: wiki.search is not a function HOT 1
- How to make this chaining work? HOT 3
- [TS] Page.content() has incorrect return type HOT 3
- Include article url in most viewed list HOT 2
- Is there a way to use behind proxy?
- .info() returns wrong data HOT 2
- No way to dump templates? HOT 1
- Query support? HOT 3
- Need help: wiki() is not a function HOT 4
- Fetch smaller images for mainImage()? HOT 1
- Error when building wikijs with Vite: Cannot acces stream.Transfrom in client code
- Invalid types in ESM project
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wiki.