$imageId = $matches[1]; $url = ''; foreach ($post->Images as $img) { if ($img->ID != $imageId) { continue; } $url = $img->Urls->_1680->Url; break; } echo "-\t" . $url . "\n"; /*preg_match('/src="(.*?)"/', $matches[0], $imgMatches); $url = $imgMatches[1]; $url = str_replace('www.neuemedienkassel.de', 'old.newmediakassel.com', $url); */ // not from the uploads directory. returning old content if (strpos(strtolower($url), '/uploads/') === false) { return $matches[0]; } $imgName = basename($url); $imgName = split('-', $imgName); array_shift($imgName); $imgName = join('-', $imgName); storeUrlToFilesystem($url, $folderPath . '/' . $imgName); return '![](' . $imgName . ')'; }, $string); // write markdown file file_put_contents($folderPath . '/' . $slug . '.md', $string); } echo "\n\nDONE!!!";
<?php $resolution = '2048'; //512 default from the player but url accepts higher values after experimentation $baseURL = 'http://cdn.rasset.ie/hds-vod/2015/1127/20151127_rteone-latelate-thelatelat_cl10498592_10498593_260_drm_/20151127_rteone-latelate-thelatelat_cl10498592_10498593_260_drm__2048' . $resolution . 'k.mp4'; $segment = 1; //Gotten from stream page by viewing network traffic. $fragments = 1810; //Gotten from stream page by viewing network traffic and going to the end of the transmission for ($fragment = 0; $fragment <= $fragments; $fragment += 1) { storeUrlToFilesystem($baseURL, $segment, $fragment); } function storeUrlToFilesystem($baseURL, $segment, $fragment) { $source = $baseURL . 'Seg' . $segment . "-Frag" . $fragment; $destination = $fragment . ".f4f"; try { $data = file_get_contents($source); $handle = fopen($destination, "w"); fwrite($handle, $data); fclose($handle); return true; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } return false; }