Upload google_play_scraper/examples/advanced_usage.py
Browse files
google_play_scraper/examples/advanced_usage.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Advanced usage examples."""
|
| 2 |
+
from google_play_scraper import reviews, collections
|
| 3 |
+
from google_play_scraper.utils.caching import clear_cache
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def get_reviews_with_caching():
|
| 7 |
+
"""Get reviews with caching enabled."""
|
| 8 |
+
clear_cache()
|
| 9 |
+
app_reviews = reviews("com.facebook.katana", n_pages=5)
|
| 10 |
+
print(f"Found {len(app_reviews)} reviews")
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def get_top_charts():
|
| 14 |
+
"""Get top chart collections."""
|
| 15 |
+
top_apps = collections("topselling_free", n_items=100)
|
| 16 |
+
for app in top_apps[:10]:
|
| 17 |
+
print(f"{app['title']} - {app['installs']}")
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
if __name__ == "__main__":
|
| 21 |
+
get_reviews_with_caching()
|
| 22 |
+
get_top_charts()
|