JoMingyu/google-play-scraper

[FEAT-REQ] To get ratings & reviews based on time frame with or without comment.

hisham-dev92 opened this issue · 2 comments

Is your feature request related to a problem?
I was trying to get fetch all reviews from Jan 1st till Mar 31st to do some analysis.

Describe the solution you'd like
Would be nice if there was an option to select the time frame.

Thanks in Advance.

Hello,

I don't think it is possible because Google doesn't provide advanced search on reviews in playstore. (edit: without crawling throught all reviews)
Best I can suggest is to modify the reviews feature by adding a datetime parameter and stop the fetching loop when is reached.

def reviews(
	app_id: str,
	date: datetime = None, # Desired date to stop
	lang: str = "en",
	country: str = "us",
	sort: Sort = Sort.NEWEST,
	count: int = 100,
	filter_score_with: int = None,
	continuation_token: _ContinuationToken = None,
) -> Tuple[List[dict], _ContinuationToken]:

# ...
# Some code...
# ...
  
		for review in review_items:
			extracted_review = {
				k: spec.extract_content(review)
				for k, spec in ElementSpecs.Review.items()
			}
			# Stop when the desired date is reached
			if date is not None and extracted_review['at'] < date:
				break
			
			result.append(extracted_review)

# ...
# Some code...
# ...

Edit: You can add another datetime parameter to avoid appending reviews before a certain date

@Plouffi answered correctly. Thanks.