1.0.1 • Published 6 years ago
murf v1.0.1
murf
Metacritic Movie user review fetcher 🎦
Description
This Node.js package fetches Metacritic Movie user reviews by scraping pages using cheerio and 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
npmnpm install murfUsing
yarnyarn add murf
Search titles using searchByQuery
Script
// 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)
[ { "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
// 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)
[ { "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, we created a lambda deployment that you can consume to search and scrape on murf-lambda.now.sh using these queries:
qto search titles (e.g.spider verse)sto scrape reviews using title slugs obtained from search (e.g.venom-2018)cto define how many to scrape (works only withs)
Example queries:
murf-lambda.now.sh/?q=spider%20verseto search titlesmurf-lambda.now.sh/?s=venom-2018to scrape reviewsmurf-lambda.now.sh/?s=venom-2018&c=3to scrape only 3 first reviews
You can view the source code for the deployment on the demo directory or on the deployment source page.
API
Haven't done this part. Do submit a pull request if you want to contribute.
Related
rotten-reviews- Scrape audience reviews from Rotten Tomatoes
License
MIT