我正在开发一个网站,在那里我需要显示所有与iOS,play商店和windows商店相关的游戏。我已经购买了iOS游戏和Windows游戏,但我无法获得与安卓游戏相关的数据。我尝试过这个链接中提到的各种文档。但没用。谷歌正在阻止他们中的大多数,其他的则与php无关。
请推荐一些最新的PHP API,用于提取Google 。
提前谢谢。
发布于 2021-12-01 13:39:55
你可以试试SerpApi。我们处理代理,解决captchas,并为您解析所有丰富的结构化数据。
使用API,您可以提取在Google页面上看到的所有内容,包括所有的评论。
用于从游戏类别检索结果的PHP代码示例(其他库中也有):
require 'path/to/google_search_results';
$query = [
"api_key" => "SECRET_API_KEY",
"engine" => "google_play",
"hl" => "en",
"store" => "apps",
"gl" => "us",
"apps_category" => "GAME"
];
$search = new GoogleSearch();
$results = $search->json($query);
示例JSON输出:
{
"organic_results": [
{
"title": "Discover recommended games",
"see_more_link": "https://play.google.com/store/apps/collection/cluster?clp=ogoQCAESBEdBTUUqAggCUgIIAQ%3D%3D:S:ANO1ljJlEdM&gsr=ChOiChAIARIER0FNRSoCCAJSAggB:S:ANO1ljJdubc",
"see_more_token": "ChOiChAIARIER0FNRSoCCAJSAggB:S:ANO1ljJdubc",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play&gl=us&hl=en&see_more_token=ChOiChAIARIER0FNRSoCCAJSAggB%3AS%3AANO1ljJdubc&store=apps",
"items": [
{
"title": "Roblox",
"link": "https://play.google.com/store/apps/details?id=com.roblox.client",
"product_id": "com.roblox.client",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play_product&gl=us&hl=en&product_id=com.roblox.client&store=apps",
"rating": 4.4,
"extansion": {
"name": "Roblox Corporation",
"link": "https://play.google.com/store/apps/dev?id=5360036014478858866"
},
"thumbnail": "https://play-lh.googleusercontent.com/OCDxsiIIxiZL6ZQYcO9Sixv6Vxl9z0avSkpd5kS6SAE_ZU_V7_rlzzA0hsesT0Z4hA=s50-rw",
"images": [
"https://play-lh.googleusercontent.com/sM1bmvALGL6yYh_UnXomtkIgO9IzoVSi5Jbo9SIPcv9p73jR5S1Xz1K-0VFZwpkcgQ=w330-h185-rw"
]
},
...
]
},
{
"title": "New & updated games",
"see_more_link": "https://play.google.com/store/apps/collection/cluster?clp=SjYKKgokcHJvbW90aW9uXzMwMDA3OTFfbmV3X3JlbGVhc2VzX2dhbWVzEEoYAxIER0FNRToCCAI%3D:S:ANO1ljJYK2k&gsr=CjhKNgoqCiRwcm9tb3Rpb25fMzAwMDc5MV9uZXdfcmVsZWFzZXNfZ2FtZXMQShgDEgRHQU1FOgIIAg%3D%3D:S:ANO1ljICr10",
"see_more_token": "CjhKNgoqCiRwcm9tb3Rpb25fMzAwMDc5MV9uZXdfcmVsZWFzZXNfZ2FtZXMQShgDEgRHQU1FOgIIAg%3D%3D:S:ANO1ljICr10",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play&gl=us&hl=en&see_more_token=CjhKNgoqCiRwcm9tb3Rpb25fMzAwMDc5MV9uZXdfcmVsZWFzZXNfZ2FtZXMQShgDEgRHQU1FOgIIAg%253D%253D%3AS%3AANO1ljICr10&store=apps",
"items": [
{
"title": "Subway Surfers",
"link": "https://play.google.com/store/apps/details?id=com.kiloo.subwaysurf",
"product_id": "com.kiloo.subwaysurf",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play_product&gl=us&hl=en&product_id=com.kiloo.subwaysurf&store=apps",
"rating": 4.6,
"extansion": {
"name": "SYBO Games",
"link": "https://play.google.com/store/apps/dev?id=7363891306616760846"
},
"thumbnail": "https://play-lh.googleusercontent.com/N0cRWzreD-MT_IwcXKkK20Rzp10G1alWKGbw9McpfZ8Qa19SY-W3o0thOivS3BhZV4c=s50-rw",
"images": [
"https://play-lh.googleusercontent.com/i4h0nob9adP_bV7obHFJ0FSK2AwK2nGwSvml1Cudh0ni2U-Sb69wYuDzzCHFv6U3RX7T=w330-h185-rw"
]
},
...
]
},
{
"title": "Pre-registration games",
"subtitle": "Coming soon to Play",
"see_more_link": "https://play.google.com/store/apps/collection/cluster?clp=Sj0KMQorcHJvbW90aW9uXzMwMDAwMDBkNTFfcHJlX3JlZ2lzdHJhdGlvbl9nYW1lcxBKGAMSBEdBTUU6AggC:S:ANO1ljLVQMI&gsr=Cj9KPQoxCitwcm9tb3Rpb25fMzAwMDAwMGQ1MV9wcmVfcmVnaXN0cmF0aW9uX2dhbWVzEEoYAxIER0FNRToCCAI%3D:S:ANO1ljJICV4",
"see_more_token": "Cj9KPQoxCitwcm9tb3Rpb25fMzAwMDAwMGQ1MV9wcmVfcmVnaXN0cmF0aW9uX2dhbWVzEEoYAxIER0FNRToCCAI%3D:S:ANO1ljJICV4",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play&gl=us&hl=en&see_more_token=Cj9KPQoxCitwcm9tb3Rpb25fMzAwMDAwMGQ1MV9wcmVfcmVnaXN0cmF0aW9uX2dhbWVzEEoYAxIER0FNRToCCAI%253D%3AS%3AANO1ljJICV4&store=apps",
"items": [
{
"title": "Diablo Immortal",
"link": "https://play.google.com/store/apps/details?id=com.blizzard.diablo.immortal",
"product_id": "com.blizzard.diablo.immortal",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play_product&gl=us&hl=en&product_id=com.blizzard.diablo.immortal&store=apps",
"extansion": {
"name": "Blizzard Entertainment, Inc.",
"link": "https://play.google.com/store/apps/dev?id=8636572569301896616"
},
"thumbnail": "https://play-lh.googleusercontent.com/8DtlOHx-zIncYJE-kwHnOTBXycjAzwufkuk0uad7_MzWP17auA24THldTwhEru-b-7I=s50-rw",
"images": [
"https://play-lh.googleusercontent.com/IS3ExSTM5IskRgZQnF4RrTPUwh-D4TGlXdfahj33DGr-Y4CW55UpEeqyw6gazdpg-Q=w330-h185-rw"
]
},
...
]
},
...
},
"serpapi_pagination": {
"next": "https://serpapi.com/search.json?apps_category=GAME&engine=google_play&gl=us&hl=en&next_page_token=CsEBit_FqQO6AQgLENu_tbHXLxjbnqn8AxiCmMGOBRjprfD4Dhi_p5XjChij3diZBBjrr7AZGNzm9LsCGO3Y7eUCGMSuxcUFGKyKn6IJIIjZv3Iggf2anwEg_8m-igsgpY3k9gIggN_E5wsg6Kn7XyD_77mICiDe84i7AiDcu9vcCCDvosrNDyCGhuTFCyDKh_-IByDGsKfmCSCksMK5BSCQoczUBCDEoLO4CyDKm7-xCiC92tC9BSDl1tznASC-t4SMDBAK&store=apps",
"next_page_token": "CsEBit_FqQO6AQgLENu_tbHXLxjbnqn8AxiCmMGOBRjprfD4Dhi_p5XjChij3diZBBjrr7AZGNzm9LsCGO3Y7eUCGMSuxcUFGKyKn6IJIIjZv3Iggf2anwEg_8m-igsgpY3k9gIggN_E5wsg6Kn7XyD_77mICiDe84i7AiDcu9vcCCDvosrNDyCGhuTFCyDKh_-IByDGsKfmCSCksMK5BSCQoczUBCDEoLO4CyDKm7-xCiC92tC9BSDl1tznASC-t4SMDBAK"
}
}
有关更多细节,请查看文档。
在游乐场上实时测试搜索。
你也可以得到特定的游戏结果。
检索Pokémon GO
结果的示例PHP代码:
require 'path/to/google_search_results';
$query = [
"api_key" => "SECRET_API_KEY",
"engine" => "google_play_product",
"store" => "apps",
"gl" => "us",
"product_id" => "com.nianticlabs.pokemongo"
];
$search = new GoogleSearch();
$results = $search->json($query);
示例JSON输出:
{
"product_info": {
"title": "Pokémon GO",
"editors_choice": {
"link": "https://play.google.com/store/apps/editors_choice",
"thumbnail": "https://play-lh.googleusercontent.com/DGQjTn_Hp32i88g2YrbjrCwl0mqCPCzDjTwMkECh3wXyTv4y6zECR5VNbAH_At89jGgSJDQuSKsPSB-wVQ=s14-rw"
},
"authors": [
{
"name": "Niantic, Inc.",
"link": "https://play.google.com/store/apps/developer?id=Niantic,+Inc."
}
],
"categories": [
{
"name": "Adventure",
"link": "https://play.google.com/store/apps/category/GAME_ADVENTURE",
"category_id": "GAME_ADVENTURE",
"serpapi_link": "https://serpapi.com/search.json?apps_category=GAME_ADVENTURE&engine=google_play&gl=us&hl=en&store=apps"
}
],
"content_rating": {
"text": "Everyone",
"thumbnail": "https://play-lh.googleusercontent.com/IciOnDFecb5Xt50Q2jlcNC0LPI7LEGxNojroo-s3AozcyS-vDCwtq4fn7u3wZmRna8OewG9PBrWC-i7i=w56-h14-rw"
},
"rating": 4.3,
"reviews": 14951022,
"extansions": [
"Offers in-app purchases"
],
"thumbnail": "https://play-lh.googleusercontent.com/jRKLgsCxR-jPnDBogDgx2Vj2MXy0_jBhhEcGJmmCjSnScUYabjSLEyAvnCmwmiNBXw=s180-rw",
"offers": [
{
"text": "Install",
"link": "https://play.google.com/store/apps/details?id=com.nianticlabs.pokemongo&rdid=com.nianticlabs.pokemongo&feature=md&offerId"
}
],
"description": "New! Now you can battle other Pokémon GO Trainers online! Try the GO Battle League today!Join Trainers across the globe who are discovering Pokémon as they explore the world around them. Pokémon GO is the global gaming sensation that has been downloaded over 1 billion times and named “Best Mobile Game” by the Game Developers Choice Awards and “Best App of the Year” by TechCrunch._______________Uncover the world of Pokémon: Explore and discover Pokémon wherever you are! Catch more Pokémon to complete your Pokédex! Journey alongside your Buddy Pokémon to help make your Pokémon stronger and earn rewards!Compete in epic Gym battles and...Team up with other Trainers to catch powerful Pokémon during Raid Battles! It’s time to get moving—your real-life adventures await! Let’s GO!_______________Notes: - This app is free-to-play and offers in-game purchases. It is optimized for smartphones, not tablets.- Compatible with Android devices that have 2GB RAM or more and have Android Version 6.0–10.0+ installed.- Compatibility is not guaranteed for devices without GPS capabilities or devices that are connected only to Wi-Fi networks.- Application may not run on certain devices even if they have compatible OS versions installed.- It is recommended to play while connected to a network in order to obtain accurate location information.- Compatibility information may be changed at any time.- Please visit PokemonGO.com for additional compatibility information. - Information current as of October 20, 2020.Read moreCollapse"
},
"media": {
"video": {
"thumbnail": "https://play-lh.googleusercontent.com/KgDQ-Kjb2B7_jDP-8KmQDNhAmP2lqAV_w3zArOCBL7YZnQ02Qqp4VTlgdocO-4MFk4s=w720-h310-rw",
"link": "https://www.youtube.com/embed/DFXbVBFPOOs?ps=play&vq=large&rel=0&autohide=1&showinfo=0"
},
"images": [
"https://play-lh.googleusercontent.com/O-OR6Mh0AoNyiaYYaa3OJ_VHGfLqWW2qNzUUZxRRodD3fqs2Pm04FatavdNbz-jsMZM=w720-h310-rw",
...
]
},
"reviews": [
{
"title": "Aiden Cooper",
"avatar": "https://play-lh.googleusercontent.com/a-/AOh14GhjS7nHA19xmSqgW_7T3ngu5zTjDO46K9ZF--l33A",
"rating": 3,
"snippet": "Game is fun but a lot of features don't work correctly. One important example of this is Adventure Sync. I enable it and accept permissions, and I log off hoping it track throughout the day. I log on again, and it's recorded nothing at all, and says it's on. Then I log in again another time and it says it's off. Please fix this, it's very difficult to hatch eggs.",
"likes": 23,
"date": "November 29, 2021"
},
...
],
"what_s_new": {
"snippet": "Trainers, there’s always something new in Pokémon GO! - From November 5, 2021, to November 14, 2021, celebrate light overcoming darkness with an all-new event, Festival of Lights!- Visual changes have been added to indicate when either your Pokémon storage or Item Bag is full. The center of the Poké Ball menu icon will turn orange when your Pokémon storage is full and revert to gray when storage space is made available."
},
"additional_information": {
"updated": [
{
"snippet": "November 18, 2021"
}
],
"size": [
{
"snippet": "Varies with device"
}
],
"installs": [
{
"snippet": "100,000,000+"
}
],
"current_version": [
{
"snippet": "0.223.1"
}
],
"requires_android": [
{
"snippet": "6.0 and up"
}
],
"content_rating": [
{
"snippet": "EveryoneMild Fantasy ViolenceLearn more"
},
{
"snippet": "EveryoneMild Fantasy ViolenceLearn more"
},
{
"snippet": "Learn more",
"link": "https://support.google.com/googleplay?p=appgame_ratings"
}
],
"interactive_elements": [
{
"snippet": "In-Game Purchases"
}
],
"in_app_products": [
{
"snippet": "$0.99 - $99.99 per item"
}
],
"permissions": [
{
"snippet": "View details"
}
],
"report": [
{
"snippet": "Flag as inappropriate",
"link": "https://support.google.com/googleplay/?p=report_content"
}
],
"offered_by": [
{
"snippet": "Niantic, Inc."
}
],
"developer": [
{
"snippet": "Visit website",
"link": "https://niantic.helpshift.com/a/pokemon-go/?p=web"
},
{
"snippet": "pokemon-go-support@nianticlabs.com",
"link": "https://play.google.commailto:pokemon-go-support@nianticlabs.com"
},
{
"snippet": "Privacy Policy",
"link": "https://nianticlabs.com/privacy/pokemongo/en"
},
{
"snippet": "Visit websitepokemon-go-support@nianticlabs.comPrivacy PolicyOne Ferry Building, Suite 200 San Francisco, CA 94111"
}
]
},
"similar_results": [
{
"title": "Similar",
"see_more_link": "https://play.google.com/store/apps/collection/cluster?clp=ogonCBEqAggIMh8KGWNvbS5uaWFudGljbGFicy5wb2tlbW9uZ28QARgD:S:ANO1ljKcNx0&gsr=CiqiCicIESoCCAgyHwoZY29tLm5pYW50aWNsYWJzLnBva2Vtb25nbxABGAM%3D:S:ANO1ljLVe3w",
"see_more_token": "CiqiCicIESoCCAgyHwoZY29tLm5pYW50aWNsYWJzLnBva2Vtb25nbxABGAM%3D:S:ANO1ljLVe3w",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play&gl=us&hl=en&see_more_token=CiqiCicIESoCCAgyHwoZY29tLm5pYW50aWNsYWJzLnBva2Vtb25nbxABGAM%253D%3AS%3AANO1ljLVe3w&store=apps",
"items": [
{
"title": "Slugterra: Slug it Out 2",
"link": "https://play.google.com/store/apps/details?id=com.dhxmedia.slugitout2",
"product_id": "com.dhxmedia.slugitout2",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play_product&gl=us&hl=en&product_id=com.dhxmedia.slugitout2&store=apps",
"description": "Pick up Greneater, Aquafreak, and Nightgeist in the Ghoul Slug Pack!",
"rating": 4.7,
"extansion": {
"name": "Epic Story Interactive",
"link": "https://play.google.com/store/apps/dev?id=5905438781451669270"
},
"thumbnail": "https://play-lh.googleusercontent.com/PgphCA3N_CSH_mLekZ_0RHiXS7FOUSlZdaCIwmEGZ2Q7I4eJkJVvYSb6Q3Lt8YP3LPZf=s128-rw"
},
...
]
},
{
"title": "More by Niantic, Inc.",
"see_more_link": "https://play.google.com/store/apps/collection/cluster?clp=igM-ChkKEzc2MzI0NjkyNzI0MzEyMjQxMjkQCBgDEh8KGWNvbS5uaWFudGljbGFicy5wb2tlbW9uZ28QARgDGAE%3D:S:ANO1ljJ8G8M&gsr=CkGKAz4KGQoTNzYzMjQ2OTI3MjQzMTIyNDEyORAIGAMSHwoZY29tLm5pYW50aWNsYWJzLnBva2Vtb25nbxABGAMYAQ%3D%3D:S:ANO1ljKQOY4",
"see_more_token": "CkGKAz4KGQoTNzYzMjQ2OTI3MjQzMTIyNDEyORAIGAMSHwoZY29tLm5pYW50aWNsYWJzLnBva2Vtb25nbxABGAMYAQ%3D%3D:S:ANO1ljKQOY4",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play&gl=us&hl=en&see_more_token=CkGKAz4KGQoTNzYzMjQ2OTI3MjQzMTIyNDEyORAIGAMSHwoZY29tLm5pYW50aWNsYWJzLnBva2Vtb25nbxABGAMYAQ%253D%253D%3AS%3AANO1ljKQOY4&store=apps",
"items": [
{
"title": "Pikmin Bloom",
"link": "https://play.google.com/store/apps/details?id=com.nianticlabs.pikmin",
"product_id": "com.nianticlabs.pikmin",
"serpapi_link": "https://serpapi.com/search.json?engine=google_play_product&gl=us&hl=en&product_id=com.nianticlabs.pikmin&store=apps",
"description": "Make every step count!",
"rating": 3.6,
"extansion": {
"name": "Niantic, Inc.",
"link": "https://play.google.com/store/apps/developer?id=Niantic,+Inc."
},
"thumbnail": "https://play-lh.googleusercontent.com/lZhO5dn3aCCBkqfFBMCFQeTsCaCfKA_wdmXsco4HtZoy970MSPnXTSbm5Ub-Z3glHA=s128-rw"
},
...
]
}
],
}
有关更多细节,请查看文档。
在游乐场上实时测试搜索。
免责声明:我在SerpApi工作。
发布于 2014-11-24 11:52:03
https://stackoverflow.com/questions/25547755
复制相似问题