UNPKG

gm-review-scraper

Version:

A tool to scrape Google Maps reviews

58 lines (43 loc) 1.45 kB
# Google Maps Review Scraper A Node.js library for scraping reviews from Google Maps. ## Installation ```bash npm install gm-review-scraper ``` ## Usage ```javascript import { GMRScraper } from "gm-review-scraper"; // Google Maps place URL or short URL const url = "https://www.google.com/maps/place/..."; // const url = "https://maps.app.goo.gl/....."; // Options const options = { sort_type: "newest", // 'relevent', 'newest', 'highest_rating', 'lowest_rating' search_query: "", // Optional search term to filter reviews pages: "max", // Number of pages to scrape or 'max' clean: true, // Return cleaned data key: "your_google_api_key", // Optional for additional statistics }; // Initialize scraper with options const scraper = new GMRScraper(options); async function getReviews() { try { // Pass URL to scrape method const result = await scraper.scrape(url); console.log(`Found ${result.reviews.length} reviews`); console.log(result.statistical); console.log(result); } catch (error) { console.error("Error scraping reviews:", error); } } getReviews(); ``` ## Options - `sort_type`: How to sort reviews ('relevent', 'newest', 'highest_rating', 'lowest_rating') - `search_query`: Filter reviews by search term - `pages`: Number of pages to scrape or 'max' for all available - `clean`: Whether to return cleaned data - `key`: Optional Google API key for additional statistics ## License ISC