macbre/nodemw

getImagesFromArticle() method failing

Closed this issue · 5 comments

Hello,

I'm trying to use the getImagesFromArticle call on the bot and I'm not sure what I'm doing wrong, but it doesn't seem to be working the way it is supposed to. This is how I'm calling it:

client.getImagesFromArticle(bodyParsed[i].comName, function (err, data) {
    if (err) { console.error(err) }
    console.log('images: ');
    console.log(data);
})

Here is where the problem occurs:

20150409_011112

Any suggestions are much appreciated! Thanks!

but it doesn't seem to be working the way it is supposed to

Please define "it doesn't seem to be working" :)

Well, you see how the page object is expected to have an images property and how at that moment, the page object does not have an images property? I just keep getting an empty array. I would expect at least one image after looking at that page in my browser and seeing that that page indeed has images:

screenshot_2015-04-09-08-49-49

@jakehockey10: getImagesFromArticle is covered by nodemw tests and it works fine.

Just tested it on English Wikipedia's "Canada goose" article and I get the following set of images:

[ { ns: 6,
    title: 'File:At home in Llyn Coed Y Dinas - geograph.org.uk - 781969.jpg' },
  { ns: 6, title: 'File:BgforhuntingCrop.JPG' },
  { ns: 6, title: 'File:Branta canadensis (5).JPG' },
  { ns: 6,
    title: 'File:Branta canadensis - Canada Goose - XC62259.ogg' },
  { ns: 6,
    title: 'File:Branta canadensis -near Oceanville, New Jersey, USA -flying-8.jpg' },
  { ns: 6, title: 'File:Branta canadensis MWNH 1968.JPG' },
  { ns: 6, title: 'File:Branta canadensis map.png' },
  { ns: 6,
    title: 'File:Canada Geese, Heaton Park - geograph.org.uk - 490384.jpg' },
  { ns: 6,
    title: 'File:Canada Geese Nesting on Beaver Lodge, Crawford County, PA 1960.jpg' },
  { ns: 6, title: 'File:Canada Geese in pond.jpg' } ]

Are you using the most up-to-date version of nodemw?

Sorry for the late response, was away for a bit. Thanks for your response. I'm still having trouble finding images but had gotten something similar to your output there at one point very briefly. But looking at that, I wonder how I can use that file. Is there any way to render these files? With this response, it wouldn't look like it...

What do you mean by "render these files"? Get URL to the originals or thumbnails? There's no method for that in nodemw. Feel free to file a feature request :)