Skip to content
Permalink
Browse files

✨ Refactors and cleanups

  • Loading branch information...
grikomsn committed Feb 12, 2019
1 parent 4295e21 commit 009f7889015cec821a5f00826f5a221a15f39da0
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at hello@griko.id. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
@@ -0,0 +1,23 @@
# Contributing

When contributing to this repository, please first discuss the change you wish to make via issue,
email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

## Pull Request Process

1. Ensure any install or build dependencies are removed before the end of the layer when doing a
build.
2. Update the README.md with details of changes to the interface, this includes new environment
variables, exposed ports, useful file locations and container parameters.
3. Increase the version numbers in any examples files and the README.md to the new version that this
Pull Request would represent. The versioning scheme we use is [Semantic Versioning](https://semver.org).
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
do not have permission to do that, you may request the second reviewer to merge it for you.

## Code of Conduct

View our [code of conduct](CODE_OF_CONDUCT.md).

<!-- Template from https://gist.github.com/PurpleBooth/b24679402957c63ec426 -->
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: grikomsn
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: grikomsn
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
@@ -0,0 +1,39 @@
<!--- Provide a general summary of your changes in the Title above -->

<!-- markdownlint-disable MD002 MD041 -->

## Description

<!--- Describe your changes in detail -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## How Has This Been Tested

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, tests ran to see how -->
<!--- your change affects other areas of the code, etc. -->

## Screenshots (if appropriate)

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Checklist

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.

<!-- PR template from https://github.com/stevemao/github-issue-templates/blob/master/questions-answers/PULL_REQUEST_TEMPLATE.md -->
141 README.md
@@ -1,9 +1,144 @@
<div align='center'>

# grikomsn/murf
# murf

[Metacritic Movie](https://www.metacritic.com/movie) User Review Fetcher 🎦
[Metacritic Movie](https://www.metacritic.com/movie) user review fetcher 🎦

![Scraping GIF](https://media.giphy.com/media/f1fN1qdc29EAg/giphy.gif)
[![NPM version](https://img.shields.io/npm/v/murf.svg)](https://www.npmjs.com/package/murf)
[![NPM download count](https://img.shields.io/npm/dt/murf.svg)](https://www.npmjs.com/package/murf)
[![Greenkeeper badge](https://badges.greenkeeper.io/grikomsn/murf.svg)](https://greenkeeper.io)

[![Scraping GIF](https://media.giphy.com/media/f1fN1qdc29EAg/giphy.gif)](https://www.npmjs.com/package/murf)

</div>

## Description

This Node.js package fetches [Metacritic Movie](https://www.metacritic.com/movie) user reviews by scraping pages using [`cheerio`](https://github.com/cheeriojs/cheerio) and [`node-fetch`](https://github.com/bitinn/node-fetch). Notable features such as:

- Fetch whole user reviews or by defined value
- Compiled from Typescript to CommonJS and ES modules
- Typescript declaration file available

Note that this package doesn't use official packages or API endpoints provided by Metacritic.

## Usage

### Adding to your project

- Using `npm`

```sh
npm install murf
```

- Using `yarn`

```sh
yarn add murf
```

### Search titles using `searchByQuery`

- Script

```js
// using require (commonjs)
const { searchByQuery } = require('murf')
// using import (es module)
import { searchByQuery } from 'murf'
searchByQuery('venom').then(results => {
console.log(JSON.stringify(results, null, 2))
})
```

- Output (truncated, fetched on February 13, 2019)

```json
[
{
"name": "Venom",
"year": 2018,
"slug": "venom-2018",
"url": "...",
"image": "...",
"score": 35,
"scoreWord": "unfavorable"
},
{
"name": "Venom",
"year": 2005,
"slug": "venom",
"url": "...",
"image": "...",
"score": 25,
"scoreWord": "unfavorable"
}
]
```

### Fetch reviews using `scrapeReviews`

- Script

```js
// using require (commonjs)
const { scrapeReviews } = require('murf')
// using import (es module)
import { scrapeReviews } from 'murf'
scrapeReviews('venom-2018').then(results => {
console.log(JSON.stringify(results, null, 2))
})
```

- Output (truncated, fetched on February 13, 2019)

```json
[
{
"reviewer": "moviemitch96",
"date": "Oct 5, 2018",
"score": 6,
"review": "..."
},
{
"reviewer": "rusty_toaster",
"date": "Oct 5, 2018",
"score": 7,
"review": "..."
},
...
]
```

### Lambda Deployment

Powered with [Zeit Now](https://zeit.co/now), we created a lambda deployment that you can consume to search and scrape on [`murf-lambda.now.sh`](https://murf-lambda.now.sh) using these queries:

- `q` to search titles (e.g. `spider verse`)
- `s` to scrape reviews using title slugs obtained from search (e.g. `venom-2018`)
- `c` to define how many to scrape (works only with `s`)

Example queries:

- [`murf-lambda.now.sh/?q=spider%20verse`](https://murf-lambda.now.sh/?q=spider%20verse) to search titles
- [`murf-lambda.now.sh/?s=venom-2018`](https://murf-lambda.now.sh/?s=venom-2018) to scrape reviews
- [`murf-lambda.now.sh/?s=venom-2018&c=3`](https://murf-lambda.now.sh/?s=venom-2018) to scrape only 3 first reviews

You can view the source code for the deployment on the [demo directory](demo) or on the [deployment source page](https://murf-lambda.now.sh/_src).

## API

Haven't done this part. Do [submit a pull request](https://github.com/grikomsn/murf/compare) if you want to contribute.

## Related

- [`rotten-reviews`](https://github.com/ninetwenty-one/rotten-reviews) - Scrape audience reviews from [Rotten Tomatoes](https://www.rottentomatoes.com)

## License

MIT
@@ -0,0 +1,28 @@
const { parse } = require('url')
const { searchByQuery, scrapeReviews } = require('murf')

/**
* @param {import('http').IncomingMessage} req
* @param {import('http').ServerResponse} res
*/
module.exports = async (req, res) => {
const { query } = parse(req.url, true)
const { s = null, c = 10, q = null } = query

if (s && c) {
const results = await scrapeReviews(s, c)
res.end(JSON.stringify(results, null, 2))
return
}

if (q) {
const results = await searchByQuery(q)
res.end(JSON.stringify(results, null, 2))
return
}

res.writeHead(301, {
Location: 'https://github.com/grikomsn/murf',
})
res.end()
}
@@ -0,0 +1,11 @@
{
"version": 2,
"name": "murf",
"alias": ["murf-lambda.now.sh"],
"builds": [{ "src": "index.js", "use": "@now/node" }],
"github": {
"enabled": true,
"autoAlias": true
},
"public": true
}
@@ -0,0 +1,12 @@
{
"name": "murf-demo",
"description": "Example usage for murf package 🎦",
"version": "1.0.0",
"author": "Griko Nibras <grikomsn@gmail.com>",
"main": "index.js",
"dependencies": {
"murf": "^1.0.0-canary"
},
"license": "MIT",
"private": true
}

0 comments on commit 009f788

Please sign in to comment.
You can’t perform that action at this time.