修改一下 \modules\tad_gphotos\class\Crawler.php 裡面的getAlbum($url)
public function getAlbum($url)
{
$response = $this->client->get($url, ['http_errors' => false]);
if ($response->getStatusCode() !== 200) {
return false;
}
$html = $response->getBody()->getContents();
$re = '/<script class="ds:1" nonce="[^"]+">AF_initDataCallback\(\{[^<]+, data:([^<]+)\}\);<\/script>/m';
preg_match_all($re, $html, $matches, PREG_SET_ORDER, 0);
$json = $matches[0][1];
$json = str_replace(", sideChannel: {}", '', $json);
$data = json_decode($json, true);
$images = array_map(function ($image) {
return [
'id' => $image[0],
// default url
'url' => $image[1][0],
// max size
'width' => $image[1][1],
'height' => $image[1][2],
];
}, $data[1]);
$this->data = [
'id' => $data[3][0],
'name' => $data[3][1],
'images' => $images,
];
return $this->data;
}