Comments (13)
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.
Umm, I'm on it. Testing.
from scrape-it.
Cannot reproduce it. I npm install
ed 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.
Closing due to no response.
from scrape-it.
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.
@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.
Yep, I get the expected result with curl. Seems to work just fine.
from scrape-it.
What about running the tests? Are they passing?
from scrape-it.
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.
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.
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.
@mirkojotic Do the tests pass? I'm not sure.
from scrape-it.
@powlo Phew! 🙈 Good point! Updated the example in that post too!
from scrape-it.
Related Issues (20)
- What is the reason for this jump in popularity? HOT 1
- Encoding issue with Spanish accents HOT 3
- Cannot find name Cheerio / CheerioSelector / CheerioStatic HOT 1
- Add support for conditional selector HOT 1
- Meta Data HOT 1
- no space between tag HOT 1
- Move scrapeHTML into its own package HOT 1
- Headers of type HTTP/2 HOT 1
- scrapeHTML is not defined HOT 1
- Alternative selectors for one element HOT 1
- Scrape a table with image links. HOT 1
- Parsing tables and xpath
- Can't select nth element HOT 1
- Scrape Behind Login HOT 1
- commas on next line in readme HOT 1
- $ is not a function in a Remix App HOT 1
- Doesn't return tag script attribute value HOT 1
- Doesn't work with :nth-child selector HOT 1
- [Feature request] "OR" query
- Can't use :not(:fist-child) nor eq in listItem HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scrape-it.