Giter Club home page Giter Club logo

Comments (13)

powlo avatar powlo commented on July 18, 2024 2

I think the issue is that the syntax has changed for the {opts} parameter and the example posted here does not work.

This works:

// Fetch the articles on the page (list)
scrapeIt("http://ionicabizau.net", {
    articles : {
        listItem: ".article"
      , data: {
            createdAt: {
                selector: ".date"
              , convert: x => new Date(x)
            }
          , title: "a.article-title"
          , tags: {
                selector: ".tags"
              , convert: x => x.split("|").map(c => c.trim()).slice(1)
            }
          , content: {
                selector: ".article-content"
              , how: "html"
            }
        }
    }
}, (err, page) => {
    console.log(err || page);
});

This does not work (taken from blog post):

// Fetch the articles on the page (list)
scrapeIt("http://ionicabizau.net", {
    listItem: ".article"
  , name: "articles"
  , data: {
        createdAt: {
            selector: ".date"
          , convert: x => new Date(x)
        }
      , title: "a.article-title"
      , tags: {
            selector: ".tags"
          , convert: x => x.split("|").map(c => c.trim()).slice(1)
        }
      , content: {
            selector: ".article-content"
          , how: "html"
        }
    }
}, (err, page) => {
    console.log(err || page);
});

Note, the change in structure for {opts}; each key is now the "name" of the scraped list.

from scrape-it.

IonicaBizau avatar IonicaBizau commented on July 18, 2024

Umm, I'm on it. Testing.

from scrape-it.

IonicaBizau avatar IonicaBizau commented on July 18, 2024

Cannot reproduce it. I npm installed and ran node example and it's working for me.

Can you post the output of node -v and tell me how you did it?

from scrape-it.

IonicaBizau avatar IonicaBizau commented on July 18, 2024

Closing due to no response.

from scrape-it.

freshyill avatar freshyill commented on July 18, 2024

I get the same thing with both 6.9.2 and 7.2.1. All I'm doing is using the readme example. Even simplifying it results in the same thing.

from scrape-it.

IonicaBizau avatar IonicaBizau commented on July 18, 2024

@freshyill Hmm... Weird. If you do a curl -L ionicabizau.net do you get a bunch of HTML output in the terminal?

from scrape-it.

freshyill avatar freshyill commented on July 18, 2024

Yep, I get the expected result with curl. Seems to work just fine.

from scrape-it.

IonicaBizau avatar IonicaBizau commented on July 18, 2024

What about running the tests? Are they passing?

from scrape-it.

polo2ro avatar polo2ro commented on July 18, 2024

Hi,
i began using scrap-it as a dependency, this work but i experienced problems with selectors. So i tried to clone the repository and got an error with npm install:

npm ERR! git clone [email protected]:github:chalk/ansi-styles Clonage dans le dépôt nu '/home/paul/.npm/_git-remotes/git-github-com-github-chalk-ansi-styles-0915ce26'
npm ERR! git clone [email protected]:github:chalk/ansi-styles Permission denied (publickey).
npm ERR! git clone [email protected]:github:chalk/ansi-styles fatal: Impossilble de lire le dépôt distant.
npm ERR! git clone [email protected]:github:chalk/ansi-styles
npm ERR! git clone [email protected]:github:chalk/ansi-styles Veuillez vérifier que vous avez les droits d'accès
npm ERR! git clone [email protected]:github:chalk/ansi-styles et que le dépôt existe.
npm ERR! notarget No compatible version found: ansi-styles@'github:chalk/ansi-styles#5dadc5c6333127f95dc0dc09ada4fbde8bf66e69'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.1.0","0.1.1","0.1.2","0.2.0","1.0.0","1.1.0","2.0.0","2.0.1","2.1.0","2.2.1","3.0.0"]
npm ERR! notarget
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! System Linux 4.9.0-2-amd64
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/paul/git/scrape-it
npm ERR! node -v v4.7.2
npm ERR! npm -v 1.4.21
npm ERR! code ETARGET

from scrape-it.

polo2ro avatar polo2ro commented on July 18, 2024

A google search lead me to this issue:
vercel/vercel#65

this work:
npm install --production

here are the lines in npm-debug.log:


3119 verbose about to build /home/paul/git/scrape-it/node_modules/tester
3120 verbose node_modules/tester unbuild
3121 info preuninstall [email protected]
3122 info uninstall [email protected]
3123 verbose true,/home/paul/git/scrape-it/node_modules,/home/paul/git/scrape-it/node_modules unbuild [email protected]
3124 info postuninstall [email protected]
3125 error notarget No compatible version found: ansi-styles@'github:chalk/ansi-styles#5dadc5c6333127f95dc0dc09ada4fbde8bf66e69'

from scrape-it.

mirkojotic avatar mirkojotic commented on July 18, 2024

Hi,

Just tried this package today and got similar issue. Error I'm getting is:
Error: There is no element selected for the 'data' field. Please provide a selector, list item or use nested object structure.

Even with first and most basic example on github.
node -v 7.4.0
npm -v 4.0.5

scrapeIt(url, { listItem: '.articles', // this retrieves articles data: { // but this throws an error selector: '.title' }, cb)

from scrape-it.

IonicaBizau avatar IonicaBizau commented on July 18, 2024

@mirkojotic Do the tests pass? I'm not sure.

from scrape-it.

IonicaBizau avatar IonicaBizau commented on July 18, 2024

@powlo Phew! 🙈 Good point! Updated the example in that post too!

from scrape-it.

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.