chore: renamed iris to mercury

pull/5/head
Adam Pash 8 years ago
parent 005ba47f6f
commit 2ae2dba690

@ -0,0 +1 @@
dist

3807
dist/mercury.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -1,8 +1,8 @@
{
"name": "readability-parser",
"name": "mercury-parser",
"version": "1.0.0",
"description": "",
"main": "./dist/iris.js",
"main": "./dist/mercury.js",
"scripts": {
"start": "node ./build",
"lint": "eslint src/** --fix",

@ -3,12 +3,12 @@ import babelrc from 'babelrc-rollup'
import commonjs from 'rollup-plugin-commonjs'
export default {
entry: 'src/iris.js',
entry: 'src/mercury.js',
plugins: [
commonjs(),
babel(babelrc()),
],
format: 'cjs',
dest: 'dist/iris.js', // equivalent to --output
dest: 'dist/mercury.js', // equivalent to --output
sourceMap: true,
}

@ -1,14 +1,14 @@
import assert from 'assert';
import fs from 'fs';
import Iris from 'iris';
import Mercury from 'mercury';
describe('NYMagExtractor', () => {
it('works with a feature story', (async) () => {
const html = fs.readFileSync('./fixtures/nymag.com/ailes.html');
const uri = 'http://nymag.com/daily/intelligencer/2016/09/how-fox-news-women-took-down-roger-ailes.html';
const { dek, title, author } = await Iris.parse(uri, html);
const { dek, title, author } = await Mercury.parse(uri, html);
const actualDek = 'How Fox News women took down the most powerful, and predatory, man in media.';
assert.equal(dek, actualDek);

@ -1,14 +1,14 @@
import assert from 'assert';
import fs from 'fs';
import Iris from 'iris';
import Mercury from 'mercury';
describe('TwitterExtractor', () => {
it('works with a feature story', (async) () => {
const html = fs.readFileSync('./fixtures/twitter.com/tweet.html');
const uri = 'https://twitter.com/KingBeyonceStan/status/745276948213968896';
const { title, author, date_published } = await Iris.parse(uri, html);
const { title, author, date_published } = await Mercury.parse(uri, html);
assert.equal(title, 'Lina Morgana on Twitter');
assert.equal(author, '@KingBeyonceStan');

@ -9,7 +9,7 @@ import getExtractor from 'extractors/get-extractor';
import RootExtractor from 'extractors/root-extractor';
import collectAllPages from 'extractors/collect-all-pages';
const Iris = {
const Mercury = {
async parse(url, html, opts = {}) {
const { fetchAllPages = true } = opts || true;
@ -65,4 +65,4 @@ const Iris = {
};
export default Iris;
export default Mercury;

@ -1,45 +1,45 @@
import assert from 'assert';
import { Errors } from 'utils';
import Iris from './iris';
import Mercury from './mercury';
describe('Iris', () => {
describe('Mercury', () => {
describe('parse(url)', function test() {
this.timeout(1000000);
it('returns an error if a malformed url is passed', async function() {
const error = await Iris.parse('foo.com');
const error = await Mercury.parse('foo.com');
assert.equal(error, Errors.badUrl);
});
it('returns an error if a bad url is passed', async function() {
const error = await Iris.parse('foo.com');
const error = await Mercury.parse('foo.com');
assert.equal(error, Errors.badUrl);
});
it('does the whole thing', async function() {
const result = await Iris.parse('http://theconcourse.deadspin.com/phyllis-schlafly-finally-croaks-1786219220');
const result = await Mercury.parse('http://theconcourse.deadspin.com/phyllis-schlafly-finally-croaks-1786219220');
assert.equal(typeof result, 'object');
// console.log(result)
});
it('does blogger', async function() {
const result = await Iris.parse('https://googleblog.blogspot.com/2016/08/onhub-turns-one-today.html');
const result = await Mercury.parse('https://googleblog.blogspot.com/2016/08/onhub-turns-one-today.html');
assert.equal(typeof result, 'object');
});
it('does wikipedia', async function() {
const result = await Iris.parse('https://en.wikipedia.org/wiki/Brihadeeswarar_Temple_fire');
const result = await Mercury.parse('https://en.wikipedia.org/wiki/Brihadeeswarar_Temple_fire');
assert.equal(typeof result, 'object');
// console.log(result)
});
it('does the nyt', async function() {
const result = await Iris.parse('http://www.nytimes.com/2016/08/16/upshot/the-state-of-the-clinton-trump-race-is-it-over.html?_r=0');
const result = await Mercury.parse('http://www.nytimes.com/2016/08/16/upshot/the-state-of-the-clinton-trump-race-is-it-over.html?_r=0');
assert.equal(typeof result, 'object');
assert.equal(result.total_pages, 1);
@ -48,7 +48,7 @@ describe('Iris', () => {
it('does ars pagination', async function() {
const url = 'http://arstechnica.com/gadgets/2016/08/the-connected-renter-how-to-make-your-apartment-smarter/';
const result = await Iris.parse(
const result = await Mercury.parse(
url,
null,
{ fetchAllPages: true }
Loading…
Cancel
Save