PHP 简单 HTML DOM 解析器返回空白图像

PHP Simple HTML DOM Parser returns blank images

提问人:Nolesh 提问时间:2/9/2019 更新时间:2/9/2019 访问量:240

问:

我正在使用库(版本 1.5 ($Rev: 196 $)) 从中解析页面以获取屏幕截图。问题是有时它会返回空白图像 () 而不是应用程序屏幕截图(例如 )。SimpleHtmlDomGoogle Playdata:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOwhttps://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);   
}

如何解决此问题?

php google-play simple-html-dom

评论

1赞 pguardiario 2/10/2019
这些是 base64 编码的图像。您需要将前部剥离到comme,然后base64解码其余部分
0赞 Nolesh 2/18/2019
@pguardiario,我知道它们是 base64 编码的图像。问题是他们不应该在这里。我希望获得指向图像的正确链接,而不是编码为 base64 的空白图像。这很奇怪,但现在我只得到 2 个有效链接。其余链接是 base64 空白图像。我什至尝试了第 3 方实现 Google Play Scraper 并得到了相同的结果。

答: 暂无答案