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

Added a property to check if a meta description is present or not. #45

Open sstottelaar opened 6 years ago

sstottelaar commented 6 years ago

Currently it's not possible to see if the page hold a meta description or not, since it retrieves the first paragraph if there is nothing present. I've added a parameter that holds information if there was a meta description present or not, depending on the outcome.

gabceb commented 6 years ago

Hi! Thanks for your PR. Wouldnt !!client.description be equivalent to the newly added descriptionPresent prop?

sstottelaar commented 6 years ago

I'm not sure. Currently if there is no description present, it will look for the first paragraph and get the description from there. So there is no way to tell if the tag is present or not, since it will always be filled. I'm not sure what the !! operator does in this case. Still learning JS, so if I'm mistaken please enlighten me!