#!/usr/bin/env php packageName; collectFile($package, $data->media->discover, 'discover'); if (count($data->media->screenshots ?? [])) { $pos = 0; foreach ($data->media->screenshots as $url) { collectFile($package, $url, 'screenshot-' . ++$pos); } } if (count($data->media->details ?? [])) { $pos = 0; foreach ($data->media->details as $detail) { if ($detail->type == 'image') { collectFile($package, $detail->url, 'detail-' . ++$pos); collectFile($package, $detail->thumb, 'detail-' . $pos . '-thumb'); } } } //die(); } function collectFile($package, $url, $type) { preg_match('#https://www.filepicker.io/api/file/([^/]+)/convert\?w=720#', $url, $matches); if (isset($matches[1])) { $url = 'https://d3e4aumcqn8cw3.cloudfront.net/api/file/' . $matches[1]; } echo $url . "\n"; return; echo $package . "," . $type . "," . $url . "\n"; } ?>