React Native compatible readability
A layer on top of the Mozilla Readability module using react-native compatible modules. This module attempts to first clean the HTML of broken elements and tags before extracting the clean HTML.
npm install react-native-readability --save
import readability from 'react-native-readability';
const url = 'http://www.bbc.com/news/business-42942921';
return fetch(url)
.then((response) => response.text())
.then((responseData) => readability.cleanHtml(responseData, url))
.then((cleanHtml) => {
console.log(cleanHtml.content);
console.log(cleanHtml.title);
});
{
byline: '', // Author (if found)
content: '', // Clean HTML
excerpt: '', // Short description of HTML
length: 0, // Byte length of clean HTML
title: '', // Title of web page
}
Clone this project from GitHub
npm install
npm test
If you find any bugs or have a feature request, please create an issue in GitHub.
- Fork it (https://github.com/jameslawler/react-native-readability)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request
Distributed under the MIT license. See LICENSE
for more information.