Skip to content

Latest commit

 

History

History
102 lines (75 loc) · 2.48 KB

File metadata and controls

102 lines (75 loc) · 2.48 KB

JavaScript / Node.js — App Store & Google Play Reviews Scraper

Use the official apify-client to run the App Reviews Scraper from Node.js. Client-side usage only — the Actor runs on Apify.

Install

npm i apify-client

Basic run

import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_TOKEN' });

const input = {
  store: 'both',
  appIds: ['com.spotify.music', '324684580'],
  country: 'us',
  language: 'en',
  sort: 'newest',
  maxReviews: 1000,
};

// Run the Actor and wait for it to finish
const run = await client.actor('logiover/app-reviews-scraper').call(input);

// Fetch the review items from the run's dataset
const { items } = await client.dataset(run.defaultDatasetId).listItems();

console.log(`Collected ${items.length} reviews`);
console.log(items[0]);

Filter to negative reviews for a specific version

const run = await client.actor('logiover/app-reviews-scraper').call({
  store: 'google_play',
  appIds: ['com.spotify.music'],
  country: 'us',
  sort: 'newest',
  maxReviews: 5000,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();

const badReviewsForVersion = items.filter(
  (r) => r.sentiment === 'negative' && r.appVersion === '8.9.44.575',
);

console.log(`${badReviewsForVersion.length} negative reviews for this version`);

Scrape iOS reviews across multiple storefronts

const run = await client.actor('logiover/app-reviews-scraper').call({
  store: 'app_store',
  appIds: ['324684580'],
  appleCountries: ['us', 'gb', 'ca', 'au', 'de'],
  maxReviews: 20000,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(`Collected ${items.length} App Store reviews across storefronts`);

Paginate a large dataset

const datasetClient = client.dataset(run.defaultDatasetId);
let offset = 0;
const limit = 1000;
const all = [];

while (true) {
  const { items } = await datasetClient.listItems({ offset, limit });
  if (items.length === 0) break;
  all.push(...items);
  offset += items.length;
}

console.log(`Total: ${all.length} reviews`);

Quick sentiment breakdown

const counts = items.reduce((acc, r) => {
  acc[r.sentiment] = (acc[r.sentiment] ?? 0) + 1;
  return acc;
}, {});

console.log(counts); // { positive: 812, neutral: 96, negative: 92 }

▶️ Run it: https://apify.com/logiover/app-reviews-scraper