Giter Site home page Giter Site logo

Comments (7)

jo12bar avatar jo12bar commented on May 18, 2024

I can take a look at this (accepted the task in Google CodeIn 2016 😉). Can you maybe tell me what version of node and npm you're using? Just run node --version and npm --version.

from html-metadata.

jo12bar avatar jo12bar commented on May 18, 2024

Also, I'm just going to assume that debug() is a variant of console.log() or console.error().

from html-metadata.

brezuicabogdan avatar brezuicabogdan commented on May 18, 2024

$ node --version v6.9.4
$ npm --version 3.10.10

And yes, sorry , debug just handles/displays to console
Let me know if I can be of any help or you need more info.

Thanks.

from html-metadata.

jo12bar avatar jo12bar commented on May 18, 2024

I'm having trouble reproducing this bug. Here's the versions of everything I've tested it on:

Windows 10 Home x64
==========
- Node v6.8.1 & npm v3.3.11

Ubuntu 14.04.5 LTS
==========
- Node v4.7.2 & npm v2.15.11
- Node v6.9.4 & npm v3.10.10
- Node v7.4.0 & npm v4.0.5

Here's the code that I used for my testing:

const htmlMetadata = require('html-metadata');

function testCallbackBased() {
  htmlMetadata('http://www.google.com', (err, metadata) => {
    if (err) {
      console.error('[testCallbackBased]: Scraper html-metadata failed! ', err);
    }
    else {
      console.log('[testCallbackBased]: html-metadata returned: ', metadata);
    }
  });
}

function testPromiseBased() {
  htmlMetadata('http://www.google.com')
    .then((m) => console.log('[testPromiseBased]: html-metadata returned: ', m))
    .catch((e) => console.error('[testPromiseBased]: Scraper html-metadata failed! ', e));
}

testCallbackBased();

testPromiseBased();

In all scenarios, the above code produces output like this:

$ node .
(node:13152) DeprecationWarning: parse() is deprecated, use toJson()
[testPromiseBased]: html-metadata returned:  { general: { title: 'Google', lang: 'en-CA' },
  openGraph:
   { description: 'Sandford Fleming’s 190th Birthday! #GoogleDoodle',
     image:
      { url: 'http://www.google.com/logos/doodles/2017/sandford-flemings-190th-birthday-5693910618734592.2-thp.png',
        width: '519',
        height: '230' } },
  schemaOrg: { items: [ [Object] ] } }
[testCallbackBased]: html-metadata returned:  { general: { title: 'Google', lang: 'en-CA' },
  openGraph:
   { description: 'Sandford Fleming’s 190th Birthday! #GoogleDoodle',
     image:
      { url: 'http://www.google.com/logos/doodles/2017/sandford-flemings-190th-birthday-5693910618734592.2-thp.png',
        width: '519',
        height: '230' } },
  schemaOrg: { items: [ [Object] ] } }

This is all with html-metadata at the lastest commit (958991b) and at v1.6.2.

I've honestly got no idea what's going on here - I looked at all the files mentioned in your stacktrace, and I can't find any issues. Did you maybe want to try reinstalling html-metadata? Or do you have a repo that I can look at?

from html-metadata.

jo12bar avatar jo12bar commented on May 18, 2024

Hey @brezuicabogdan, so I chatted with @mvolz and we think that since no one can reproduce this issue we might have to close it... Sorry 😓

I'd still be totally willing to help you with this problem whenever you want - it just doesn't seem to be thus module's fault.

Again, sorry about this!

from html-metadata.

brezuicabogdan avatar brezuicabogdan commented on May 18, 2024

It's on @jo12bar , I am a developer I know how this works. I only submitted this bug report because I know bugs are important to developers and I would like people to do this for me too. I managed to resolve my problem with another module for not and I will get back to html-metadata as soon as I find the time. I will try to find the problem myself but I am not very experienced with NodeJs (I'm a PHP developer myself). I will send you a PM if I need help.
Thanks for everything.

from html-metadata.

MadsAppvice avatar MadsAppvice commented on May 18, 2024

Hi all, I am not experiences in how to contribute in such an open source project.

But I stumpled on this error, and it seems to be caused by line 31 in lib/index.js where a for of loop is used. This will at least in my version of node (v10.16.3) result in custom functions on the Array object together with the actual entries. Thus if one has a custom function on the array prototype, this will fail.

The solution is to use Object.keys(results) instead, or any other means that do not include the prototype functions.

I hope it helps, my local copy is patched and it works wonderfully:-)

Cheers
Mads

from html-metadata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.