streaming-crawler.js that reads articles from first X pages
✓ Published0🌍 Public
Aalessioalex
Last edited Nov 22, 2014
Created on Nov 22, 2014
This example streams the first five pages of Hacker News articles and extracts each story’s title and link. It uses the `request` library to fetch each page, then pipes the HTML through `html-tokenize` and `html-select` to parse elements matching the `.title a` selector. As text and attribute data flow through, the code logs each article’s href and title to the console, skipping links marked with `rel="nofollow"`. The process chains pages sequentially, incrementing the page number until reaching the stop condition, and finally reports the total number of pages crawled.
AI-generated description