Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #6 : Should be able to fetch the next page #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sebastiendb
Copy link

You can know fetch next page from an article. I modified the xhr function to use mikeal request instead.
Also, the callback is raised only if all pages are fetched.
This pull contained a package.json updated, a simple "test" for the multi-page and the patch for encoding trouble.

Sébastien De Bollivier added 2 commits April 28, 2012 13:12
Before :
Readability: ---DOM created
Braquage cette nuit � Saint-Pierre <div id="corps"><p><p>Deux hommes, arriv�s � bord d’un scooter, ont fait irruption cette nuit vers 3h30 chez un marchand de fruits et l�gumes ouvert 24h/24 � Saint-Pierre. Ils auraient alors menac� d’une arme � feu le g�rant en r�clamant la caisse. Mais ne seraient repartis qu’avec la balance, croyant sans doute qu’elle pouvait contenir de l’argent. Pour le magasin, le pr�judice �conomique est donc plut�t l�ger. Mais si personne n’a �t� bless�, le braqu� est �videmment choqu�.</p>

After:
Readability: ---DOM created
Braquage cette nuit à Saint-Pierre <div id="corps"><p><p>Deux hommes, arrivés à bord d’un scooter, ont fait irruption cette nuit vers 3h30 chez un marchand de fruits et légumes ouvert 24h/24 à Saint-Pierre. Ils auraient alors menacé d’une arme à feu le gérant en réclamant la caisse. Mais ne seraient repartis qu’avec la balance, croyant sans doute qu’elle pouvait contenir de l’argent. Pour le magasin, le préjudice économique est donc plutôt léger. Mais si personne n’a été blessé, le braqué est évidemment choqué.</p>

<p><strong>Plus d’informations demain dans votre Journal de l’île.</strong></p></p></div>

if you use request (from mikeal for example), you will just have to do this :

var readability = require('../lib/readability');
var url = "http://www.clicanoo.re/322520-braquage-cette-nuit-a-saint-pierre.html";
var request = require('request');
request({url:url, 'encoding':'binary'}, function (error, response, html) {
  var content_type = response['headers']['content-type'].split('=');
  var encoding = content_type[1].toUpperCase();
  if (!error && response.statusCode == 200) {
    readability.parse(html, url, {encoding:encoding}, function(result) {
   		console.log(result.title, result.content);
	});
  }
});
You can know fetch next page from an article. I modified the xhr function to use mikeal request instead.
Also, the callback is raised only if all pages are fetched.
This pull contained a package.json updated, a simple "test" for the multi-page and the patch for encoding trouble.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant