Git Product home page Git Product logo

Comments (4)

dijs avatar dijs commented on July 18, 2024

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.

dijs avatar dijs commented on July 18, 2024

Fixed in v4.3.3

from wiki.

kper avatar kper commented on July 18, 2024

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.

kper avatar kper commented on July 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.