Đây là code Get Direct Link nhé chứ không phải get link youtube như trên mạng đã share đâu nhé ace
- Khi getlink sẽ ra dạng
http://r3---sn-42u-8j5e.googlevideo.com/videoplayback?mt=1462192589&ratebypass=yes&signature=09E962CA4FE0DF35DAF19C3D0ECE2FCE32C81974.9623BA73888D7FBF3B5311E3A1D258EF08F73F86&expire=1462214627&lmt=1458222938197242&fexp=9416126%2C9416891%2C9416903%2C9422596%2C9427379%2C9427543%2C9428398%2C9431012%2C9432422%2C9432650%2C9432683%2C9432773%2C9433096%2C9433946%2C9434290%2C9434343%2C9434497%2C9434609%2C9435347%2C9435412%2C9435810&itag=22&source=youtube&mm=31&upn=ki4h_HDK_80&sver=3&dur=343.794&id=o-AGYCDFltONa1ivzokrUySbYBBPax9xNWf3v3U69mUDXF&mn=sn-42u-8j5e&key=yt6&mime=video%2Fmp4&ms=au&mv=u&pl=22&ipbits=0&sparams=dur%2Cid%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Cratebypass%2Csource%2Cupn%2Cexpire&pcm2cms=yes&ip=103.254.12.50
Đây là code Get Direct Link
<?php
//Code by vuvanhoan
@set_time_limit(0);
$id = $_GET['url']; //'zXpCUTPmAp8';
parse_str(file_get_contents('http://www.youtube.com/get_video_info?video_id='.$id), $info);
$medyalar = explode(',', $info['url_encoded_fmt_stream_map']);
foreach($medyalar as $medya) {
parse_str($medya, $this);
$js .= '<source src="'.$this['url'].'" type="video/mp4" data-res="'.$this['quality'].'px" />';
}
?>
Còn đây là co de hoàn chỉnh cho player
<?php
//Code by vuvanhoan
@set_time_limit(0);
$id = $_GET['url']; //'zXpCUTPmAp8';
parse_str(file_get_contents('http://www.youtube.com/get_video_info?video_id='.$id), $info);
$medyalar = explode(',', $info['url_encoded_fmt_stream_map']);
foreach($medyalar as $medya) {
parse_str($medya, $this);
$js .= '<source src="'.$this['url'].'" type="video/mp4" data-res="'.$this['quality'].'px" />';
}
echo'<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link href="http://vidcaster.github.io/video-js-resolutions/video-js/video-js.min.css" rel="stylesheet" type="text/css" />
<link href="http://vidcaster.github.io/video-js-resolutions/video-js-resolutions/video-js-resolutions.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://vidcaster.github.io/video-js-resolutions/video-js/video.dev.js"></script>
<script type="text/javascript" src="http://vidcaster.github.io/video-js-resolutions/video-js-resolutions/video-js-resolutions.js"></script> <style>
body {
height: 100%;
margin: 0;
overflow: hidden;
position: absolute;
width: 100%;
}
video,#home_video {
min-height: 100%;
min-width: 100%;
position: absolute;
}
.vjs-default-skin .vjs-menu-button ul li.vjs-selected {
background-color: #0EEAB8;
color: red;
}
.fullscreen-bg {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
width: 100%;
height: 100%;
}
.fullscreen-bg__video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.vjs-default-skin .vjs-big-play-button{top:45%;left:45%}
</style>
</head>
<body>
<!-- 859e46bd9ef63e4b8668aacec38edf31 dfef8bfaf0b10147b1c85e017363d447 c53494597ea1583ef7e5e19831463485-->
<div class="fullscreen-bg">
<video id="home_video" data-setup="{"customControlsOnMobile": true,"autoplay":false}" controls autoplay
poster="" class="video-js vjs-default-skin fullscreen-bg__video">
'.$js.'
</video>
</div>
<script type="text/javascript">
vjs("home_video", {
plugins: {
resolutions: true,
customControlsOnMobile: true
}
});
</script>
<style>.vjs-default-skin .vjs-big-play-button{top:45%;left:45%}#bs-notice{position: absolute;bottom: 10px;top:auto;right: 5px;text-align: center;font-size: 13pt; font-family: Arial;font-style: italic;color: #fff;box-shadow: 0 0 1px rgba(255, 255, 255, 0.48);padding:5px 10px;background:rgba(0, 0, 0, 0.54);border-radius:3px;z-index: 2147483647;}#bs-skip {position: absolute;top:auto;right: 5px;bottom: 10px;text-align: center;font-size: 20px !important;display: none; z-index: 2147483647;padding:5px 20px;background:rgb(0, 0, 0) !important;color:yellow;box-shadow: 0 0 1px rgba(255, 255, 255, 0.48)}#bs-skip:hover{cursor:pointer;color:yellow;background:transparent}</style>
</body>
</html>';
?>
Link youtube:https://www.youtube.com/watch?v=ONOerPb5A7c
Ta lấy mỗi ID thôi nha
Link getlink dang: http://domain.com/youtube.php?url= ONOerPb5A7c
0 nhận xét:
Đăng nhận xét