michalbe / wiki-infobox

Simple Wikipedia infobox scraper
https://github.com/michalbe/wiki-infobox
MIT License
16 stars 8 forks source link

Change 'text' to something more meaningfull in returned nodes #39

Open michalbe opened 9 years ago

michalbe commented 9 years ago

For now, the library return different types of nodes, like link:

{ 
    type: 'link',
    text: 'British Columbia',
    url: 'http://en.wikipedia.org/wiki/British Columbia' 
}

or image:

{ 
    type: 'image',
    text: '260px',
    url: 'http://en.wikipedia.org/wiki/File:MacGyver intro.jpg' 
}

and after #37 & #38 will land also text:

{
  type: 'text',
  text: '37'
}

text attribute in those objects has no sense anymore, so it should be change to value for text nodes and links and size for images, so the object will look like this:

[ { 
   type: 'link',
   value: 'British Columbia',
   url: 'http://en.wikipedia.org/wiki/British Columbia' 
},
{ 
    type: 'image',
    size: '260px',
    url: 'http://en.wikipedia.org/wiki/File:MacGyver intro.jpg' 
},
{
  type: 'text',
  value: '37'
}]
michalbe commented 9 years ago

maybe data makes more sense than size & value ?

raphaelparent commented 8 years ago

@michalbe is this still worth fixing? I'm looking to get involved in some projects on github and this seems to be a good place to start!

michalbe commented 8 years ago

@raphaelparent of course, I wasn't improving this package for quite a while now, but I'm still using it, so all the help is welcomed.

raphaelparent commented 8 years ago

Hey @michalbe I have noticed that the image never gets the actual size, they always get either the name (like Image:Warsaw Metro logo.svg) or the word "frameless". Is that normal?