undefinedor/google-play-scraper
Composer 安装命令:
composer require undefinedor/google-play-scraper
包简介
A PHP scraper to get app data from Google Play
关键字:
README 文档
README
A PHP scraper to get app data from Google Play.
Installation
Add undefinedor/google-play-scraper as a require dependency in your composer.json file:
$ composer require undefinedor/google-play-scraper
Usage
First create a Scraper instance.
use Raulr\GooglePlayScraper\Scraper; $scraper = new Scraper();
There are several methods to configure the default behavior:
setDelay($delay): Sets the delay in milliseconds between requests to Google Play site.setDefaultLang($lang): Sets the default language for all requests.$langmust be an ISO_639-1 two letter language code. If not set, the default language isen.setDefaultCountry($country): Sets the default country for all requests.$countrymust be an ISO_3166-1 two letter country code. If not set, the default country isus.
getApp
Gets app information given its ID.
Parameters
$id: Google Play app identifier.$lang: (optional, defaults tonull): Overrides the default language.$country: (optional, defaults tonull): Overrides the default country.
Example
$app = $scraper->getApp('com.mojang.minecraftpe');
Returns:
array ( 'id' => 'com.mojang.minecraftpe', 'url' => 'https://play.google.com/store/apps/details?id=com.mojang.minecraftpe', 'image' => 'https://lh3.googleusercontent.com/30koN0eGl-LHqvUZrCj9HT4qVPQdvN508p2wuhaWUnqKeCp6nrs9QW8v6IVGvGNauA=w300', 'title' => 'Minecraft: Pocket Edition', 'author' => 'Mojang', 'author_link' => 'https://play.google.com/store/apps/developer?id=Mojang', 'categories' => array ( 'Arcade', 'Creativity', ), 'price' => '$6.99', 'screenshots' => array ( 'https://lh3.googleusercontent.com/VkLE0e0EDuRID6jdTE97cC8BomcDReJtZOem9Jlb14jw9O7ytAGvE-2pLqvoSJ7w3IdK=h310', 'https://lh3.googleusercontent.com/28b1vxJQe916wOaSVB4CmcnDujk8M2SNaCwqtQ4cUS0wYKYn9kCYeqxX0uyI2X-nQv0=h310', // [...] ), 'description' => 'Our latest free update includes the Nether and all its inhabitants[...]', 'description_html' => 'Our latest free update includes the Nether and all its inhabitants[...]', 'rating' => 4.4726405143737793, 'votes' => 1136962, 'last_updated' => 'October 22, 2015', 'size' => 'Varies with device', 'downloads' => '10,000,000 - 50,000,000', 'version' => 'Varies with device', 'supported_os' => 'Varies with device', 'content_rating' => 'Everyone 10+', 'whatsnew' => 'Build, explore and survive on the go with Minecraft: Pocket Edition[...]', 'video_link' => 'https://www.youtube.com/embed/D2Z9oKTzzrM?ps=play&vq=large&rel=0&autohide=1&showinfo=0&autoplay=1', 'video_image' => 'https://i.ytimg.com/vi/D2Z9oKTzzrM/hqdefault.jpg', )
The following fields may contain a null value: price, size, downloads, version, whatsnew, video_link and video_image. The price being null means the app is free.
getApps
Gets information for multiple apps given their IDs.
Parameters
$ids: Array of Google Play app identifiers.$lang: (optional, defaults tonull): Overrides the default language.$country: (optional, defaults tonull): Overrides the default country.
Example
$app = $scraper->getApps(array( 'com.mojang.minecraftpe', 'com.google.android.youtube', ));
getCategories
Returns an array with the existing categories in Google Play.
Example
use Raulr\GooglePlayScraper\Scraper; $scraper = new Scraper(); $categories = $scraper->getCategories();
Returns:
array ( 'BOOKS_AND_REFERENCE', 'BUSINESS', 'COMICS', 'COMMUNICATION', 'EDUCATION', 'ENTERTAINMENT', 'FINANCE', 'HEALTH_AND_FITNESS', 'LIBRARIES_AND_DEMO', 'LIFESTYLE', 'APP_WALLPAPER', 'MEDIA_AND_VIDEO', 'MEDICAL', 'MUSIC_AND_AUDIO', 'NEWS_AND_MAGAZINES', 'PERSONALIZATION', 'PHOTOGRAPHY', 'PRODUCTIVITY', 'SHOPPING', 'SOCIAL', 'SPORTS', 'TOOLS', 'TRANSPORTATION', 'TRAVEL_AND_LOCAL', 'WEATHER', 'APP_WIDGETS', 'GAME_ACTION', 'GAME_ADVENTURE', 'GAME_ARCADE', 'GAME_BOARD', 'GAME_CARD', 'GAME_CASINO', 'GAME_CASUAL', 'GAME_EDUCATIONAL', 'GAME_MUSIC', 'GAME_PUZZLE', 'GAME_RACING', 'GAME_ROLE_PLAYING', 'GAME_SIMULATION', 'GAME_SPORTS', 'GAME_STRATEGY', 'GAME_TRIVIA', 'GAME_WORD', 'FAMILY', 'FAMILY_ACTION', 'FAMILY_BRAINGAMES', 'FAMILY_CREATE', 'FAMILY_EDUCATION', 'FAMILY_MUSICVIDEO', 'FAMILY_PRETEND', )
getCollections
Returns an array with the existing collections in Google Play.
Example
$collections = $scraper->getCollections();
Returns:
array ( 'topselling_free', 'topselling_paid', 'topselling_new_free', 'topselling_new_paid', 'topgrossing', 'movers_shakers', )
getList
Retrieves a list of Google Play apps given a collection and optionally filtered by category.
Parameters
$collection: Google Play collection to retrieve. See getCollections for possible values.$category: (optional, defaults tonull) Filter request by this category. See getCategories for possible values.$lang: (optional, defaults tonull): Overrides the default language.$country: (optional, defaults tonull): Overrides the default country.
Example
$apps = $scraper->getList('topselling_free', 'SOCIAL');
Returns:
array ( array ( 'id' => 'com.facebook.katana', 'url' => 'https://play.google.com/store/apps/details?id=com.facebook.katana', 'title' => 'Facebook', 'image' => 'https://lh3.googleusercontent.com/ZZPdzvlpK9r_Df9C3M7j1rNRi7hhHRvPhlklJ3lfi5jk86Jd1s0Y5wcQ1QgbVaAP5Q=w340', 'author' => 'Facebook', 'rating' => 3.9888803958892822, 'price' => null, ), array ( 'id' => 'com.snapchat.android', 'url' => 'https://play.google.com/store/apps/details?id=com.snapchat.android', 'title' => 'Snapchat', 'image' => 'https://lh4.ggpht.com/vdK_CsMSsJoYvJpYgaj91fiJ1T8rnSHHbXL0Em378kQaaf_BGyvUek2aU9z2qbxJCAFV=w340', 'author' => 'Snapchat Inc', 'rating' => 3.8660063743591309, 'price' => null, ), // [...] )
getDetailList
Same as getList but returning full detail app data. An additional request is made for every app from the list in order to get its details.
getListChunk
Retrieves a chunk of a Google Play app list.
Parameters
$collection: Google Play collection to retrieve. See getCollections for possible values.$category: (optional, defaults tonull) Filter request by this category. See getCategories for possible values.$start: (optional, defaults to0): Starting index. Must be a value between0and500.$num: (optional, defaults to60): Amount of apps to retrieve. Must be a value between0and120.$lang: (optional, defaults tonull): Overrides the default language.$country: (optional, defaults tonull): Overrides the default country.
Example
$apps = $scraper->getListChunk('topselling_free', 'SOCIAL', 20, 80);
getDetailListChunk
Same as getListChunk but returning full detail app data. An additional request is made for every app from the list in order to get its details.
undefinedor/google-play-scraper 适用场景与选型建议
undefinedor/google-play-scraper 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 81.6k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2015 年 11 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「scraper」 「google play」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 undefinedor/google-play-scraper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 undefinedor/google-play-scraper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 undefinedor/google-play-scraper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A lightweight, dependency free PHP class that acts as wrapper for Crawlbase API
A tool for scraping URL resources (oEmbed, OpenGraph, Twitter cards, JSON-LD)
Simple way to get app market version information from Google Play store or Apple App Store
Scrapes app data from Google Play store.
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
统计信息
- 总下载量: 81.6k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-11-24