A Node.js CLI tool that fetches comprehensive business data from Google Places API and outputs structured JSON and Markdown files. Perfect for gathering information to build websites for local businesses.
# Install dependencies
npm install
# Set your API key (see setup below)
echo "GOOGLE_MAPS_API_KEY=your_key_here" > .env
# Run the scraper
npm run scrape "https://www.google.com/maps/place/Some+Business/..."
Requires Node.js 18 or later.
# Clone the repository
git clone <repo-url>
cd google-maps-downloader
# Install dependencies
npm install
Note: This tool uses the Places API (New), not the legacy Places API.
Create a .env file in the project root:
GOOGLE_MAPS_API_KEY=your_api_key_here
Or export it in your shell:
export GOOGLE_MAPS_API_KEY=your_api_key_here
npm run scrape "<google-maps-url>"
# Using a place URL
npm run scrape "https://www.google.com/maps/place/The+Coffee+Shop/@40.7484,-73.9857,17z"
# Using a URL with place_id
npm run scrape "https://maps.google.com/?place_id=ChIJN1t_tDeuEmsRUsoyG83frY4"
The tool creates two files in the ./output directory:
<business-name>.json - Structured data for programmatic use<business-name>.md - Human-readable summary for website briefs{
"meta": {
"source": "google_places_api",
"fetched_at": "2025-01-15T10:30:00.000Z",
"google_place_id": "ChIJ...",
"google_maps_url": "https://..."
},
"basic_info": {
"name": "Business Name",
"formatted_address": "123 Main St...",
"categories": ["restaurant", "bar"],
"rating": 4.5,
"user_ratings_total": 250,
"website": "https://...",
"price_level": 2
},
"contact": {
"phone": "(555) 123-4567",
"opening_hours": {
"weekday_text": ["Monday: 9:00 AM – 9:00 PM", ...],
"open_now": true
}
},
"location": {
"lat": 40.7484,
"lng": -73.9857
},
"photos": [
{
"photo_url": "https://places.googleapis.com/v1/...",
"width": 1600,
"height": 900
}
],
"reviews": {
"summary": {
"average_rating": 4.5,
"total_reviews": 250,
"stars_breakdown": { "5": 3, "4": 1, "3": 1, "2": 0, "1": 0 },
"common_themes": ["great service", "friendly staff"]
},
"items": [...]
}
}
The Markdown file includes:
The Google Places API (New) has usage-based pricing:
| Operation | Cost per 1,000 requests |
|---|---|
| Place Details (Basic) | ~$17 |
| Place Details (Advanced) | ~$20 |
| Text Search | ~$32 |
| Photos | ~$7 |
This tool uses field masks to only request needed data and minimize costs. A single business lookup typically costs a few cents.
For accurate pricing, see Google Maps Platform Pricing.
total_reviews count is accurate, but the star breakdown is based on the sample returned.# Build TypeScript
npm run build
# Run directly (builds then runs)
npm run scrape "url"
google-maps-downloader/
├── src/
│ ├── index.ts # CLI entry point
│ ├── config.ts # Environment configuration
│ ├── types.ts # TypeScript interfaces
│ ├── urlParser.ts # Google Maps URL parsing
│ ├── placesApi.ts # Places API client
│ ├── transformer.ts # API response transformation
│ ├── reviewAnalyzer.ts # Review analysis utilities
│ ├── outputJson.ts # JSON output generator
│ ├── outputMarkdown.ts # Markdown output generator
│ └── utils.ts # Utility functions
├── output/ # Generated files
├── package.json
├── tsconfig.json
└── README.md
MIT
$ claude mcp add google-maps-downloader \
-- python -m otcore.mcp_server <graph>