News for hackers. Stuff that matters.
Re:Using jQuery and node.js to scrape html pages in 5 lines by drats on Monday September 06, 2010 @03:29AM (#1666155)
Strange popup: "Hello, i see you are coming from hacker news.

the article you clicked on was most certainly not submitted by nodejitsu.

news.ycombinator has a long history of squashing articles and submitters that aren't funded by y-comb.

most of this is done through their "silent" banning and censoring mechanisms, that leave people not even realizing they have been silenced.

i hope you enjoy this article, and remember that HN is extremely biased and that you should keep your horizons broad."

While I would agree that HN is bias towards YC-funded projects I would not agree that it is biased against non-YC projects or news. In fact, the majority of the items on HN are non-YC. This also follows for submitters and commenters for the year or more I've been here.

On a different note. Hpricot is not representative of Ruby scraping anymore - nokogiri (http://nokogiri.org/) is where it's at. Which has a Hpricot translation layer if you need to change. Even when I decided to solidify on Python for everything else I will still go back to Ruby just for nokogiri when it comes to scraping.

Re:Using jQuery and node.js to scrape html pages in 5 lines by shadowsun7 on Monday September 06, 2010 @05:14AM (#1666304)
Marak, the guy behind the Nodejitsu (and, presumably, the popup message) is known to exhibit asshole behaviour. (See: http://news.ycombinator.com/item?id=1448309) The popup message is consistent with what HN knows of him.

Whether being a jerk justifies banning I can't say - but his assertion that HN is biased has little justification (particularly when you consider that the writer himself is biased.) Kindly ignore.

Re:Using jQuery and node.js to scrape html pages in 5 lines by iamelgringo on Monday September 06, 2010 @01:24PM (#1667029)
Further examples of charming behavior starting at comment 3 on this thread: http://groups.google.com/group/nodejs/browse_thread/thread/c...
Re:Using jQuery and node.js to scrape html pages in 5 lines by tigerthink on Monday September 06, 2010 @09:11PM (#1667749)
Possible justification for HN being biased:

http://news.ycombinator.com/item?id=1074079

Re:Using jQuery and node.js to scrape html pages in 5 lines by thaumaturgy on Monday September 06, 2010 @05:25AM (#1666319)
He seems to be about the same sort of asshole as a lot of other internet personalities (Theo comes to mind). i.e., he's good at what he does, knowledgeable, and he doesn't take the time to play nice with others.

It kinda comes down to what sort of "thing" HN is supposed to be -- whether it has a place for people like him -- but regardless, he's certainly not exactly hurting over his inability to play in our little sandbox here.

Re:Using jQuery and node.js to scrape html pages in 5 lines by supporting on Monday September 06, 2010 @08:03AM (#1666486)
But he's actually not knowledgeable or good at what he does -- if you view his Github page, you'll see that his projects are 100-line thefts or wrappers around other people's work.

He's been a major drain/drag on the Node.js community, and makes the IRC channel a toxic wasteland for a good part of the day.

He trolls other sites as well... http://www.youtube.com/watch?v=IrkDqh9ZVog

Re:Using jQuery and node.js to scrape html pages in 5 lines by mnutt on Monday September 06, 2010 @08:26PM (#1667683)
Say what you will about his interactions with people, but "not knowledgeable or good at what he does" is an unfair characterization.

I find his hook.io project (http://hook.io/about.html) particularly interesting, and the BDD testing app he was building for Node Knockout has a lot of potential as well.

Re:Using jQuery and node.js to scrape html pages in 5 lines by hij1nx on Monday September 06, 2010 @03:56PM (#1667296)
Marak is definitely unpleasant for some. However, he regularly contributes code to the community that people consider useful. For example among many high profile developers, Tim Caswell, a cornerstone of the Node.js community voted 5/5 for utility on the Nodejitsu Node Knockout entry. You're acting like you're a part of the Node.js community? If you or anyone is going to be so negative, they should at least have one or more nodejs projects that have been publicly noted as useful or relevant. So ironically, you're quite a troll.
Re:Using jQuery and node.js to scrape html pages in 5 lines by shadowsun7 on Monday September 06, 2010 @05:31AM (#1666326)
Perhaps, though I wouldn't put it past him to write that popup message. It reads as childish sniping, is unnecessarily snarky, and it detracts from the core message of the post.

Knowledgeable he may be, but professional he is most certainly not.

Edit: I must admit, however, that I'm interested as to why he was banned. I don't believe he's said/done anything spiteful and mean in HN itself.

Re:Using jQuery and node.js to scrape html pages in 5 lines by frio on Monday September 06, 2010 @06:51PM (#1667571)
The thing is, that when it comes to other e-assholes (Zed being the obvious one), I genuinely respect their talent, and they generally do have enough insight available to them to realise when they've stepped too far. Zed in particular pumps out code I find useful and well built (<3 Lamson), and generally, his rants aren't overly horrible.

Marak comes across as someone who's seen that and intends to emulate it, without the actual development skill or talent to back it up.

Re:Using jQuery and node.js to scrape html pages in 5 lines by brown9-2 on Monday September 06, 2010 @10:46AM (#1666759)
The language in the popup pretty much makes me not interested to actually proceed with reading the article.
Re:Using jQuery and node.js to scrape html pages in 5 lines by robinduckett on Monday September 06, 2010 @04:00AM (#1666204)
It's because all the Nodejitsu team are perma banned from HN.
Re:Using jQuery and node.js to scrape html pages in 5 lines by bambax on Monday September 06, 2010 @04:03AM (#1666212)
? Why is that?
Re:Using jQuery and node.js to scrape html pages in 5 lines by _delirium on Monday September 06, 2010 @04:10AM (#1666223)
I have no personal knowledge, but some poking around on searchyc suggests this brouhaha may have been involved: http://news.ycombinator.com/item?id=1448309
Re:Using jQuery and node.js to scrape html pages in 5 lines by iamelgringo on Monday September 06, 2010 @01:24PM (#1667030)
Re:Using jQuery and node.js to scrape html pages in 5 lines by robinduckett on Monday September 06, 2010 @04:05AM (#1666217)
"for a few reasons, but some others for much lamer"
Re:Using jQuery and node.js to scrape html pages in 5 lines by steilpass on Monday September 06, 2010 @03:36AM (#1666169)
Are there any information/discussions about the "censoring mechanisms"?
Re:Using jQuery and node.js to scrape html pages in 5 lines by iamelgringo on Monday September 06, 2010 @05:00AM (#1666289)
Over the years, I've occasionally heard of people getting kickbanned from HN. It doesn't happen that often, but when it does, it's been because of egregious trolling, spamming, etc... I've also heard of one or two voting rings that got booted as well.

It doesn't happen too often, however. The community here usually has pretty high commenting standards, and there's peer pressure that encourages good behavior.

Re:Using jQuery and node.js to scrape html pages in 5 lines by thaumaturgy on Monday September 06, 2010 @05:14AM (#1666306)
There are some individuals that are either around for a while, or just getting started, and for whatever arbitrary reason one day all of their comments and submissions will be auto-dead.

They of course aren't notified at all, so they're quite happy to keep adding comments to the site, all of which stay at 1 point and never get replied to (or even read by anyone except those with showdead on).

Since there's no messaging system on this site, if they haven't bothered to add any contact information to their userpage then there's no way to let them know.

I occasionally see these folks posting some pretty thoughtful comments while auto-dead, too.

However, this has been a subject of discussion here a few times, and nothing has changed; I don't expect it to.

I do expect that this site will be banned soon too.

Re:Using jQuery and node.js to scrape html pages in 5 lines by lzw on Monday September 06, 2010 @06:15AM (#1666382)
They could be notified by the site when they log in. People investing in thoughtful comments, or even attempting to add value to the site, who have been arbitrarily banned seems quite tragic. A community with secret rules is one to think twice about investing in. I've learned this the hard way in the past running afoul of moderators because I disagreed with one of them or their friends.
Re:Using jQuery and node.js to scrape html pages in 5 lines by jackowayed on Monday September 06, 2010 @01:23PM (#1667028)
PG says that silent banning is the best way because trolls might keep going for awhile after being banned in that case, doing no harm because they're banned. But if they know they're banned, they'll just create another account.

I'm not saying that that's the best solution. A mefi-like $5 cost to join might be better, but then a) PG has to implement the payment stuff, and b) some people will complain about us charging nontrolls to get accounts.

It's possible that there could be some system where if, say, 5 people with at least 200 karma will vouch for you, it's free, but then there's even more complicated code that needs to get written, and people will complain that you can only join HN if you pay or are part of the "in crowd" that know lots of HNers.

I actually think that could work really well though. If for the first month/50 karma, those people were supposed to moderate the sponsorees comments and give them feedback on what they're doing well and what they're doing badly, we might have a lot fewer complaints about all those noobs that are ruining our site.

Re:Using jQuery and node.js to scrape html pages in 5 lines by rb2k_ on Monday September 06, 2010 @04:45AM (#1666275)
In my benchmarks, hpricot has a better performance for simple link extraction (and regexp has an even higher one :D)
Re:Using jQuery and node.js to scrape html pages in 5 lines by aneth on Monday September 06, 2010 @04:57AM (#1666285)
I'm not sure how you can be biased toward something without being biased against everything else, but the spirit of your meaning seems true. YC companies and submitters have an institutional advantage, but I am not with a YC company and don't feel discriminated against.
Re:Using jQuery and node.js to scrape html pages in 5 lines by robinduckett on Monday September 06, 2010 @04:04AM (#1666214)
Hey guys. The Nodejitsu team and Marak (http://www.github.com/Marak), the guy behind Nodejitsu are perma-banned from HN and can't respond to your queries.

He sends his regards, and if you'd like to contact him visit the #Node.js IRC channel @ Freenode

Re:Using jQuery and node.js to scrape html pages in 5 lines by il on Monday September 06, 2010 @03:49AM (#1666188)
I have a question: Does scraping like this execute Javascript on the scraped page? Am I able to access the output of Javascript/AJAX on that page?

As far as I know this is impossible with any other server-side scraping technology.

If so, that would be amazingly useful for a couple of my side projects, much easier than parsing their Javascript code and extracting the info I need.

Re:Using jQuery and node.js to scrape html pages in 5 lines by robinduckett on Monday September 06, 2010 @04:10AM (#1666225)
You'd have to parse the page seperately and run each piece of in line scripts / linked scripts in a sandbox which can talk to jsdom, but it could be done.
Re:Using jQuery and node.js to scrape html pages in 5 lines by _delirium on Monday September 06, 2010 @04:15AM (#1666230)
Sounds like a useful general-purpose library someone could put together: server-side execution of HTML-embedded js, with some sort of configurable sandbox (e.g. decide whether you want to let it call out to the internet or not). All the components are available, but seems like the field is open for an all-in-one solution that gets the defaults and edge cases right.

I imagine Google has something at least close to that internally, given that they've dropped hints here and there about their ability to crawl post-js-processed pages, but unless I've missed it, I don't think they've released anything (my guess is because of the arms-race issue, with shady sites trying to use js to mask certain content from googlebot).

Re:Using jQuery and node.js to scrape html pages in 5 lines by il on Monday September 06, 2010 @04:48AM (#1666278)
Second this idea. Nothing like this exists currently except for a couple buggy poorly documented dead projects.

Selenium might be OK for usability testing a single site, but it's useless for large scale multithreaded crawling and scraping and doesn't scale.

I, for one, would definitely pay good money for an easy library/API to scrape JS-heavy sites without the overhead of a full browser running macros.

Re:Using jQuery and node.js to scrape html pages in 5 lines by fizx on Monday September 06, 2010 @04:41AM (#1666269)
Selenium Remote Control lets you drive a real browser from the scripting language of your choice. xvfb let's you run headless. You really don't need anything else.
Re:Using jQuery and node.js to scrape html pages in 5 lines by il on Monday September 06, 2010 @04:19AM (#1666238)
Is that due to a technical limitation or a security issue? Would everything need to run in a separate sandbox if the JS was from a trusted source(i.e. google)?
Re:Using jQuery and node.js to scrape html pages in 5 lines by vially on Monday September 06, 2010 @08:24AM (#1666506)
If you are using Java you could use HtmlUnit which has fairly good JavaScript support (including AJAX).
Re:Using jQuery and node.js to scrape html pages in 5 lines by fmw on Monday September 06, 2010 @03:29AM (#1666157)
The article lists BeautifulSoup as the Python choice for scraping, but that isn't necessarily true. I'm using http://scrapy.org/, for example, which is a scraping framework that uses lxml and xpath by default.
Re:Using jQuery and node.js to scrape html pages in 5 lines by bmelton on Tuesday September 07, 2010 @02:06PM (#1669567)
I don't know if it was edited after your post, but it lists Scrapy right next to Beautiful Soup.
[deleted]
Re:Using jQuery and node.js to scrape html pages in 5 lines by wmil on Monday September 06, 2010 @06:19AM (#1666388)
HN deletes posts to try to keeps things on topic. It's heavy handed, but there aren't a lot of ways to stop flame wars and pun threads.
Re:Using jQuery and node.js to scrape html pages in 5 lines by pygy_ on Monday September 06, 2010 @07:12AM (#1666435)
I apologize.

I deleted my former post, because the censorship accusations were based on an error on my side, I had been reading another comment thread related to the author of the post[1] and mixed things up.

[1] http://news.ycombinator.com/item?id=1448309

Re:Using jQuery and node.js to scrape html pages in 5 lines by fizx on Monday September 06, 2010 @04:30AM (#1666254)
This reminds me, I ported the core ideas of the parsley scraping language to jQuery.

http://github.com/fizx/pquery#readme

Re:Using jQuery and node.js to scrape html pages in 5 lines by tcarnell on Monday September 06, 2010 @07:51AM (#1666472)
Interesting, when I built http://cQuery.com (Content Query Engine), I investigated a number of options html parsing and content extraction options. I had played with Rhino and John Resigs env.js (http://ejohn.org/blog/bringing-the-browser-to-the-server/) to run jQuery server-side.

For portability, performance and flexability I finally settled for writing my own HTML parser and CSS selection engine from scratch.

Re:Using jQuery and node.js to scrape html pages in 5 lines by knowtheory on Monday September 06, 2010 @05:51AM (#1666348)
The article reads "The challenge with using these libraries is that they all have their own quirks that can make working with HTML, CSS and Javascript challenging."

And that's true only if you only want to do page manipulation in Javascript. I'm perfectly happy with my page manipulation in Ruby w/ Nokogiri. Here's an example:

(code formatting on HN sucks, so it's on my blog, apologies)

http://blog.knowtheory.net/post/1074676060/xml-manipulation-...

Re:Using jQuery and node.js to scrape html pages in 5 lines by forsaken on Monday September 06, 2010 @03:12AM (#1666137)
Site appears down. Is node popular enough yet for the "Node doesn't scale" talk? :)
Re:Using jQuery and node.js to scrape html pages in 5 lines by drats on Monday September 06, 2010 @03:34AM (#1666165)
Yes, as cliched as it is, I think it's time. I couldn't use at least 6/10 of the node challenge top 10 when it hit the HN front page (and the rest were beset by bugs and didn't work - the pixel one where you form characters stopped showing the shape I was supposed to be trying to get into after a few rounds, and the robot war one never let me buy or release my wave of robots on Chrome or Firefox). Overall it was totally disappointing experience.
Re:Using jQuery and node.js to scrape html pages in 5 lines by mnutt on Monday September 06, 2010 @04:27AM (#1666246)
I think there are a couple of factors here:

1. It was a 48-hour coding competition, so some bugs are to be expected.

2. The hosting for the apps in this competition was turned on literally the day before: http://twitter.com/joyent/status/22204412477

I don't think that "node can't scale" will get much press, just because node is pretty performant and many people conflate performance and scalability. Node's asynchronous api would seem pretty good in a services-oriented architecture, and scalability is mostly about how the app is architected. (and in 48 hours, that probably means "quickly")

On the other hand, node.js is still a very young platform and there are a lot of unsolved issues. As of right now there are only 3 or 4 dedicated node.js hosts that I know of, and all are in private beta. People are still trying to figure out best practices for design and testing.

The thing that I took away from Node Knockout was that here are a bunch of really cool web app ideas that, given time, could be built with node. I think the apps were 'frozen' pending judging, but I know many of the top app teams were planning on improving them as soon as they had the chance.

Re:Using jQuery and node.js to scrape html pages in 5 lines by robinduckett on Monday September 06, 2010 @04:07AM (#1666221)
Not down for me :)
Re:Using jQuery and node.js to scrape html pages in 5 lines by jfager on Monday September 06, 2010 @09:50AM (#1666648)
Ignoring the drama: my current favorite scraping combo is NekoHtml underneath Scala's completely kickass combo of pattern matching and XML literals.