movie-script-scraper
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "movie-script-scraper", | ||
"description": "Simple movie scripts scraper.", | ||
"version": "0.0.2", | ||
"description": "A simple scraper to retrieve movie scripts by genre or title from IMSDB.", | ||
"version": "0.0.3", | ||
"homepage": "https://github.com/JoeKarlsson/movie-script-scraper", | ||
@@ -39,3 +39,2 @@ "keywords": [ | ||
"prepush": "npm prune && npm run healthcheck", | ||
"postcommit": "git status", | ||
"postmerge": "npm install" | ||
@@ -54,3 +53,3 @@ }, | ||
"coveralls": "^3.0.0", | ||
"eslint": "^4.15.0", | ||
"eslint": "^4.16.0", | ||
"eslint-config-airbnb-base": "^12.1.0", | ||
@@ -57,0 +56,0 @@ "eslint-config-prettier": "^2.9.0", |
# Movie Script Scraper | ||
[![deps][deps]][deps-url] | ||
[![Coverage Status][cover]][cover-url] | ||
[![Build Status][tests]][tests-url] | ||
[![Coverage Status](https://coveralls.io/repos/github/JoeKarlsson/movie-script-scrapper/badge.svg?branch=master)](https://coveralls.io/github/JoeKarlsson/movie-script-scrapper?branch=master) | ||
[![Build Status](https://travis-ci.org/JoeKarlsson/movie-script-scrapper.svg?branch=master)](https://travis-ci.org/JoeKarlsson/movie-script-scrapper) | ||
[![stars][stars]][stars-url] | ||
@@ -17,3 +17,3 @@ [![pr][pr]][pr-url] | ||
A simple scraper to retrieve scripts by genre or title from [IMSDB](http://www.imsdb.com/). | ||
A simple scraper to retrieve movie scripts by genre or title from [IMSDB](http://www.imsdb.com/). | ||
@@ -30,3 +30,3 @@ # Installation | ||
**MSS** exposes a function; simply pass this function the options (see below), and it will return a promise with an array of the file paths of the scripts it saved. | ||
**Movie Script Scraper** exposes a function; simply pass this function the options ([see below](https://github.com/JoeKarlsson/movie-script-scraper#options)), and it will return a promise with an array of the file paths of the scripts it saved. | ||
@@ -86,3 +86,3 @@ ```javascript | ||
1. Run Tests | ||
2. Run Tests | ||
@@ -95,2 +95,4 @@ ```bash | ||
Don't hesitate to create a pull request. Every contribution is appreciated. In development you can start the tests by calling `npm test`. Checkout our [contribution README](https://github.com/JoeKarlsson/react-redux-boilerplate/blob/master/CONTRIBUTING.md) for more info. | ||
1. Fork it! | ||
@@ -97,0 +99,0 @@ 1. Create your feature branch: `git checkout -b my-new-feature` |
const getScriptsByGenre = require('./getScriptsByGenre'); | ||
const getScriptByTitle = require('./getScriptByTitle'); | ||
const cleanArr = arr => { | ||
return arr.filter(Boolean); | ||
}; | ||
const mss = async options => { | ||
@@ -13,10 +17,12 @@ let { genre, title, total, dest } = options; | ||
if (genre) { | ||
const result = await getScriptsByGenre(genre, total, dest); | ||
return result; | ||
const filePaths = await getScriptsByGenre(genre, total, dest); | ||
return cleanArr(filePaths); | ||
} else if (title) { | ||
return getScriptByTitle(title, dest); | ||
const filePaths = await getScriptByTitle(title, dest); | ||
return cleanArr(filePaths); | ||
} | ||
return getScriptsByGenre(dest); | ||
const filePaths = await getScriptsByGenre(dest); | ||
return cleanArr(filePaths); | ||
}; | ||
module.exports = mss; |
20042
329
139