gabceb / node-metainspector

Node npm for web scraping purposes. It scrapes a given URL, and returns you its title, meta description, meta keywords, an array with all the links, all the images in it, etc. Inspired by the metainspector Ruby gem
MIT License
129 stars 52 forks source link

console.log client.image() is undefiend and client.images() crashes server #6

Open sferoze opened 10 years ago

sferoze commented 10 years ago

I am trying to log out the images on a webpage and it does not work.

I have tried.

console.log 'client image ' + client.images()  // Crashes server

console.log 'client image ' + client.image() // undefined

Here is the code I am using:

client = new MetaInspector('http://cnn.com', {})

client.on 'fetch', ->
  console.log 'client image ' + client.images
  console.log 'client links ' + client.links().join(",")

client.fetch()

console.logging out client.description() & client.links() seems to work fine.

gabceb commented 10 years ago

The image() is undefined because cnn.com does not provide an meta[property='og:image'] property.

line 4 on seconds block should be client.images() because it is a function. I will update the README file. If everything works as expected close this issue.