Issue #6 : Should be able to fetch the next page#11
Open
sebastiendb wants to merge 2 commits intoarrix:masterfrom
Open
Issue #6 : Should be able to fetch the next page#11sebastiendb wants to merge 2 commits intoarrix:masterfrom
sebastiendb wants to merge 2 commits intoarrix:masterfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.