fix(market-research): match K/M/B-suffixed Play install counts

This commit is contained in:
fatih.bulut 2026-06-23 22:50:24 +03:00
parent 73e39c40e2
commit cd4edf2ad8
3 changed files with 4 additions and 4 deletions

View File

@ -67,9 +67,9 @@ def parse_details(html, package):
try: out["rating"] = float(ar["ratingValue"]) try: out["rating"] = float(ar["ratingValue"])
except Exception: pass except Exception: pass
break break
m = re.search(r'([\d,]+\+)\s*</[^>]+>\s*<[^>]*>\s*Downloads', html) m = re.search(r'([\d.,]+[KMB]?\+)\s*</[^>]+>\s*<[^>]*>\s*Downloads', html)
if not m: if not m:
m = re.search(r'([\d,]+\+)\s*<span>\s*Downloads', html) m = re.search(r'([\d.,]+[KMB]?\+)\s*<span>\s*Downloads', html)
if m: if m:
out["installs"] = m.group(1) out["installs"] = m.group(1)
m = re.search(r'Updated on\s*</[^>]+>\s*<[^>]*>([^<]+)</[^>]+>', html) m = re.search(r'Updated on\s*</[^>]+>\s*<[^>]*>([^<]+)</[^>]+>', html)

View File

@ -3,6 +3,6 @@
{"@type":"SoftwareApplication","name":"Habit Tracker","author":{"name":"Focus Labs"}, {"@type":"SoftwareApplication","name":"Habit Tracker","author":{"name":"Focus Labs"},
"applicationCategory":"Productivity","aggregateRating":{"ratingValue":"4.6","ratingCount":"120000"}} "applicationCategory":"Productivity","aggregateRating":{"ratingValue":"4.6","ratingCount":"120000"}}
</script> </script>
<div>5,000,000+</div><div>Downloads</div> <div>1B+</div><div>Downloads</div>
<div>Updated on</div><div>Jun 1, 2026</div> <div>Updated on</div><div>Jun 1, 2026</div>
</body></html> </body></html>

View File

@ -20,7 +20,7 @@ def main():
check("play_url", r["play_url"] == "https://play.google.com/store/apps/details?id=com.example.habit") check("play_url", r["play_url"] == "https://play.google.com/store/apps/details?id=com.example.habit")
check("name", r["name"] == "Habit Tracker") check("name", r["name"] == "Habit Tracker")
check("rating", r["rating"] == 4.6) check("rating", r["rating"] == 4.6)
check("installs", r["installs"] == "5,000,000+") check("installs", r["installs"] == "1B+")
check("last_updated", r["last_updated"] == "Jun 1, 2026") check("last_updated", r["last_updated"] == "Jun 1, 2026")
check("developer", r["developer"] == "Focus Labs") check("developer", r["developer"] == "Focus Labs")