Skip to content

Instantly share code, notes, and snippets.

@chandrikadeb7
Last active March 22, 2024 06:48
Show Gist options
  • Save chandrikadeb7/4088a67eaf4e229d92cb695e286a817d to your computer and use it in GitHub Desktop.
Save chandrikadeb7/4088a67eaf4e229d92cb695e286a817d to your computer and use it in GitHub Desktop.
Scrape Google Play Store Reviews of last 180 days
from google_play_scraper import Sort, reviews_all
import pandas as pd
import numpy as np
import datetime
today = datetime.date.today()
six_months_ago = today - datetime.timedelta(days=180)
# Fetch all reviews
us_reviews = reviews_all(
'_app_name_',
sleep_milliseconds=0,
lang='en',
country='in',
sort=Sort.NEWEST,
)
# Create a DataFrame from the reviews
df_busu = pd.DataFrame(np.array(us_reviews), columns=['review'])
# Split the 'review' column into individual columns
df_busu = df_busu.join(pd.DataFrame(df_busu.pop('review').tolist()))
# Convert the 'at' column to datetime
df_busu['at'] = pd.to_datetime(df_busu['at']).dt.date # Extract date part
# Filter reviews for the last 3 months
filtered_reviews = df_busu[df_busu['at'] >= six_months_ago]
# Save the filtered reviews to a CSV file
filtered_reviews.to_csv('_Path_/GooglePlayStore_last_6_months.csv', index=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment