dom query cease to be effective #21

Closed
huang47 opened this Issue Dec 21, 2011 · 2 comments

Comments

Projects
None yet
2 participants
@huang47

huang47 commented Dec 21, 2011

EXAMPLE:
https://github.com/davglass/nodejs-yui3/tree/master/examples/scrape.js

ENV:
node: 0.6.6
npm; 1.1.0-beta-4

DESCRIPTION:
run scrape.js directly and we get below messages

info: (get): Loaded: /Users/hugeh/node_modules/yui3/node_modules/yui3-core/build/intl/intl-min.js
info: (get): Loaded: /Users/hugeh/node_modules/yui3/node_modules/yui3-core/build/intl/intl-min.js
error: (nodejsyui3): ----------------------------------------------------------
error: (nodejsyui3): TypeError: Cannot call method 'set' of null
error: (nodejsyui3): at Object. (/Users/hugeh/Dropbox/project/nodejs-yui3/examples/scrape.js:10:20)
error: (nodejsyui3): at [object Object]._notify (/Users/hugeh/node_modules/yui3/node_modules/yui3-core/build/yui/yui-min.js:7:5959)
error: (nodejsyui3): at Object. (/Users/hugeh/node_modules/yui3/node_modules/yui3-core/build/yui/yui-min.js:7:5803)
error: (nodejsyui3): at [object Object]._notify (/Users/hugeh/node_modules/yui3/node_modules/yui3-core/build/yui/yui-min.js:7:5959)
error: (nodejsyui3): at Object. (/Users/hugeh/node_modules/yui3/node_modules/yui3-core/build/yui/yui-min.js:8:730)
error: (nodejsyui3): at [object Object]._notify (/Users/hugeh/node_modules/yui3/node_modules/yui3-core/build/yui/yui-min.js:7:5959)
error: (nodejsyui3): at Object. (/Users/hugeh/node_modules/yui3/node_modules/yui3-core/build/yui/yui-min.js:8:785)
error: (nodejsyui3): at [object Object]._use (/Users/hugeh/node_modules/yui3/node_modules/yui3-core/build/yui/yui-min.js:8:2095)
error: (nodejsyui3): at [object Object]. (/Users/hugeh/node_modules/yui3/node_modules/yui3-core/build/yui/yui-min.js:8:693)
error: (nodejsyui3): at Object._finish (/Users/hugeh/node_modules/yui3/node_modules/yui3-core/build/yui/yui-min.js:13:2497)
error: (nodejsyui3): ----------------------------------------------------------

In case I modify it as below

!/usr/bin/env node

var YUI = require("yui3").YUI;

YUI({ debug: true }).use('node', 'io', function(Y) {
YUI().use('node', function(remotePage) {
var url = 'http://digg.com/news';
remotePage.fetch(url, function() {
var newsItems = remotePage.all('#story-items h3');
// newsItems is empty
});
});
});

there is still no data returned.
{ _query: '#story-items h3', _nodes: [] }

is it because of yui3.4 dependency change?

@rich-hansen-ui

This comment has been minimized.

Show comment
Hide comment
@rich-hansen-ui

rich-hansen-ui Dec 28, 2011

I'm getting a similar issue while running the general-dom example. Any suggestions?

I'm getting a similar issue while running the general-dom example. Any suggestions?

@huang47

This comment has been minimized.

Show comment
Hide comment
@huang47

huang47 Feb 7, 2012

Thanks for Dav's effort
it works in my testing repo now
https://github.com/huang47/css-crawler

Hi Richard, I recommend to use yui npm package instead of yui3 now

original usage:
var YUI = require('yui3').YUI;
current:
var YUI = require('yui').YUI;

In case you need dom support, u would need install jsdom as well

huang47 commented Feb 7, 2012

Thanks for Dav's effort
it works in my testing repo now
https://github.com/huang47/css-crawler

Hi Richard, I recommend to use yui npm package instead of yui3 now

original usage:
var YUI = require('yui3').YUI;
current:
var YUI = require('yui').YUI;

In case you need dom support, u would need install jsdom as well

@huang47 huang47 closed this Feb 7, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment