Skip to content

Latest commit

 

History

History
97 lines (72 loc) · 2.46 KB

File metadata and controls

97 lines (72 loc) · 2.46 KB

Python — App Store & Google Play Reviews Scraper

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

Install

pip install apify-client

Basic run

from apify_client import ApifyClient

client = ApifyClient("YOUR_TOKEN")

run_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
run = client.actor("logiover/app-reviews-scraper").call(run_input=run_input)

# Iterate the review items from the run's dataset
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["rating"], item["appName"], "-", (item["text"] or "")[:80])

Load reviews into a pandas DataFrame

import pandas as pd
from apify_client import ApifyClient

client = ApifyClient("YOUR_TOKEN")

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

items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
df = pd.DataFrame(items)

print(df.shape)
print(df["sentiment"].value_counts())
df.to_csv("reviews.csv", index=False)

Filter negative reviews for a specific version

negative = [
    r for r in items
    if r.get("sentiment") == "negative" and r.get("appVersion") == "8.9.44.575"
]
print(f"{len(negative)} negative reviews for this version")

Scrape iOS reviews across multiple storefronts

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

items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
print(f"Collected {len(items)} App Store reviews across storefronts")

Download the dataset directly as CSV / Excel

# CSV
with open("reviews.csv", "wb") as f:
    f.write(client.dataset(run["defaultDatasetId"]).download_items(item_format="csv"))

# Excel
with open("reviews.xlsx", "wb") as f:
    f.write(client.dataset(run["defaultDatasetId"]).download_items(item_format="xlsx"))

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