<?phpHoặc chạy kiểu sau
//link to get direct link
$link = 'https://picasaweb.google.com/117116947522912120929/AnhNhoEm2012Full21Tap#6110189436068884690';
function picasa_direct($link) {
//get picasa page by default file_get_contents function
$data = file_get_contents($link);
$a = explode('"media":{"content":[', $data);
$a = explode('],"', $a[1]);
$datar = explode('},', $a[0]);
foreach ($datar as $key => $value) {
$value = str_replace("}}", "}", $value . "}");
$mp4s[] = json_decode($value, true);
}
$js = $bt = '';
for ($i = 1; $i < count($mp4s); $i++) {
$mp4 = $mp4s[$i];
$js .= '{file:"' . ($mp4['url']) . '", type:"video/mp4", label:"'.$mp4['height'].'px"},';
}
return $js;
}
//echo all link
//echo picasa_direct($link);
?>
<script src="http://content.jwplatform.com/libraries/XeGdlzmk.js"></script>
<div id="myElement">Loading the player...</div>
<script type="text/javascript">
var playerInstance = jwplayer("myElement");
playerInstance.setup({
sources: [<?php echo picasa_direct($link);?>],
width: "100%",
height: "100%",
autostart: true
});
</script>
<?php
//link to get direct link
$link = 'https://picasaweb.google.com/117116947522912120929/AnhNhoEm2012Full21Tap#6110189436068884690';
function picasa_direct($link) {
//get picasa page by default file_get_contents function
$data = file_get_contents($link);
$a = explode('"media":{"content":[', $data);
$a = explode('],"', $a[1]);
$datar = explode('},', $a[0]);
foreach ($datar as $key => $value) {
$value = str_replace("}}", "}", $value . "}");
$mp4s[] = json_decode($value, true);
}
$js = $bt = '';
for ($i = 1; $i < count($mp4s); $i++) {
$mp4 = $mp4s[$i];
$js .= '{file:"' . ($mp4['url']) . '", type:"video/mp4", label:"'.$mp4['height'].'px"},';
}
return $js;
}
//echo all link
//echo picasa_direct($link);
echo'<script src="http://content.jwplatform.com/libraries/XeGdlzmk.js"></script>
<div id="myElement">Loading the player...</div>
<script type="text/javascript">
var playerInstance = jwplayer("myElement");
playerInstance.setup({
sources: ['.picasa_direct($link).'],
width: "100%",
height: "100%",
autostart: true
});
</script>';
?>
Sau khi get được link dạng https://lh3.googleusercontent.com/NmfqcjhDwWx46rglJerRkOReu2kUJ-sN-Un-QLS15bs=m18 chúng ta bắt đầu get_headers và explode để lấy được link cần.
0 nhận xét:
Đăng nhận xét