Last active
September 26, 2015 20:16
-
-
Save hubgit/50086412ffb6f0e830e6 to your computer and use it in GitHub Desktop.
Play the ITV Player live stream (MP4) in system media player
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// pip install livestreamer | |
$doc = new DOMDocument; | |
$doc->load('http://www.itv.com/ukonly/mediaplayer/xml/sim1static.xml'); | |
$xpath = new DOMXPath($doc); | |
$url = $xpath->evaluate('string(//ManifestFile/URL)'); | |
$arg = sprintf( | |
'%s pvswf="%s"', | |
preg_replace('/^http:/', 'hds:', $url), | |
'https://www.itv.com/mediaplayer/ITVMediaPlayer.swf' | |
); | |
// add --output="filename.mp4" to save to a file | |
$command = sprintf('livestreamer %s best', escapeshellarg($arg)); | |
//print $command; | |
exec($command); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment