Created
January 20, 2019 22:09
-
-
Save shahednur/b7c4e99ca2a445dbaff61e7a8c64ba7f to your computer and use it in GitHub Desktop.
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
function getVideoUrl($link){ | |
$data = explode('.mp4', $link); | |
$decode = urldecode($data[0]); | |
$linkDownload = array(); | |
$v1080p = $decode.'_hd.mp4'; | |
$v720p = $decode.'_dvd.mp4'; | |
$v360p = $decode.'_fmt1.ogv'; | |
$linkDownload['1080p'] = $v1080p; | |
$linkDownload['720p'] = $v720p; | |
$linkDownload['360p'] = $v360p; | |
$files = ''; | |
foreach ($linkDownload as $key => $l){ | |
$files .= '["type"=> "video/mp4", "label"=> "'.$key.'", "file"=> "'.$l.'"],'; | |
} | |
if(@!$files) $files = '["type"=> "video/mp4", "label"=> "HD", "file"=> "'.$decode .'=m18'.'"]'; | |
return '['.rtrim($files, ',').']'; | |
} | |
//url in html | |
<input type="text" name="url" /> | |
//url in php | |
$url = $_POST['url']; | |
//usages of this function | |
$linkdown = getVideoUrl($url) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment