我正在使用SimpleHtmlDom
库(版本1.5($ Rev:196 $))来解析Google Play
中的页面以获得屏幕截图。问题是有时,它返回空白图像(data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw
)而不是应用程序屏幕截图(例如https://lh3.googleusercontent.com/SLp7-1W6c-LIl5nJkQWrYIb5i7b4XJwdjIox9CtnmRZF_tlWixLSsFo2vzXO6gbbOg
)。
代码:
include_once('SimpleHtmlDom.php');
$googleplay = 'https://play.google.com/store/apps/details?id=';
$application = 'com.nolesh.android.livewallpapers.quasar';
$html = $googleplay.$application.'&hl=en_EN';
$html = file_get_html($html);
$screenshots = array();
foreach($html->find('button img[itemprop="image"]') as $screenshot){
//truncate the size parameter from the end of string (=h310)
$pos = strpos($screenshot->src, '=');
$screenshots[] = substr($screenshot->src, 0, $pos);
}
如何解决此问题?