dijs / wiki

Wikipedia Interface for Node.js
MIT License
313 stars 62 forks source link

Limited infobox results? #74

Closed NothingSoup closed 6 years ago

NothingSoup commented 6 years ago

The .info method does not seem to return results for all infoboxes. For example, in the article "Cross Game", the info method only returns information for the first infobox ("Infobox animanga/Header") but there are 3 infoboxes in the article (Infobox animanga/Header, Infobox animanga/Print, and Infobox animanga/Video). Is there a way to get results for all infoboxes in an article? Code:

wiki().page('Cross Game')
    .then((page) => page.info())
    .then(console.log);

Result:

{ name: 'Cross Game',
  image: 'Cross Game v01 cover by Mitsuru Adachi.jpg',
  caption: 'Cover of the first manga volume featuring Ko (left) and Wakaba',
  jaKanji: 'クロスゲーム',
  jaRomaji: 'Kurosu Gēmu',
  genre: 'Sports' }

Expected:

[
{ name: 'Cross Game',
  image: 'Cross Game v01 cover by Mitsuru Adachi.jpg',
  caption: 'Cover of the first manga volume featuring Ko (left) and Wakaba',
  jaKanji: 'クロスゲーム',
  jaRomaji: 'Kurosu Gēmu',
  genre: 'Sports' }
,
{ type: 'manga',
  author: 'Mitsuru Adachi',
  publisher: 'Shogakukan',
  publisherEn: 'English manga publisher',
  na: 'Viz Media',
  demographic: 'Shōnen manga',
  magazine: 'Weekly Shōnen Sunday',
  first: 'May 2005',
  last: 'February 2010',
  volumes: '17',
  volumeList: 'List of Cross Game chapters' }
,
{ type: 'tv series',
  director: 'Osamu Sekita',
  studio: 'SynergySP',
  licensee: 'English anime licensee',
  na: 'Viz Media',
  network: 'TV Tokyo',
  first: 'April 5, 2009',
  last: 'March 28, 2010',
  episodes: '50',
  episodeList: 'List of Cross Game episodes' }
]
dijs commented 6 years ago

Love this idea. But I don't want to break the existing API.

How about I add a infos function or infoboxes to get the full list of parsed infoboxes.

Sound good?

NothingSoup commented 6 years ago

Yes, that would be great.

dijs commented 6 years ago

Does this solution work for you?

I wanted to replace the info method entirely, but I think I will wait for v5 to do that...

@NothingSoup

dijs commented 6 years ago

Haven't heard back, so I am just going to merge this.