Get Youtube Video Source Links | Php Open Source
Hello friends,
What is this;
With Get Youtube Video Source Link Script, you can get video source url information of YouTube videos you can easily and quickly.
Description
Get Youtube Video Source Link Script is useful for all of you. When writing the code we will get help from explode, end, substr, file_get_contents, parse_str, isset, urldecode, trim, array_map. I have explained the details of the functions below.
Functions we will use;
explode = Split a string by string
end = Set the internal pointer of an array to its last element
substr = Return part of a string
file_get_contents = Reads entire file into a string
parse_str = Parses the string into variables
isset = Determine if a variable is set and is not NULL
urldecode = Decodes URL-encoded string
trim = Strip whitespace (or other characters) from the beginning and end of a string
array_map = Applies the callback to the elements of the given arrays
Setup;
You do not need to do anything after uploading the files in Github to the server. After uploading files, it will work without any problems.
Github Project;
https://github.com/Ruhum36/Get-Youtube-Video-Source-Link
Github Profile;
Github Project;
index.php
<?php
// Ruhum
// 23.12.2017
function Qualitys($iTag){
switch ($iTag) {
case 5:
$Message = 'Flv (400x240)';
break;
case 6:
$Message = 'Flv (450x270)';
break;
case 13:
$Message = '3gp';
break;
case 17:
$Message = '3gp (176x144)';
break;
case 18:
$Message = 'Mp4 (640x360)';
break;
case 22:
$Message = 'HD - Mp4 (1280x720)';
break;
case 34:
$Message = '360p Flv - 640x360';
break;
case 35:
$Message = '480p Flv - 854x480';
break;
case 36:
$Message = '3gp - 320x240';
break;
case 37:
$Message = 'HD 1080p - Mp4 (1920x1080)';
break;
case 38:
$Message = 'HD 3072p - Mp4 (4096x3072)';
break;
case 43:
$Message = '360p - Webm (640x360)';
break;
case 44:
$Message = '480p - Webm (854x480)';
break;
case 45:
$Message = '720p - Webm (1280x720)';
break;
case 46:
$Message = '1080p - Webm (1920x1080)';
break;
default:
$Message = 'Bulunamadı';
break;
}
return $Message;
}
function GetVideoSourceUrl($Baglanti){
$YtVideoID = explode('v=', $Baglanti);
$YtVideoID = end($YtVideoID);
$YtVideoID = substr($YtVideoID, 0, 11);
$Links = array();
$Title = '';
$Source = file_get_contents('http://www.youtube.com/get_video_info?&video_id='.$YtVideoID.'&hl=tr');
parse_str($Source,$Results);
$Title = $Results['title'];
$Results['url_encoded_fmt_stream_map'] = isset($Results['url_encoded_fmt_stream_map'])?$Results['url_encoded_fmt_stream_map']:false;
if($Results['url_encoded_fmt_stream_map']){
$UrlInformation = explode(',',$Results['url_encoded_fmt_stream_map']);
foreach($UrlInformation as $Bilgi){
parse_str($Bilgi,$VideoInformation);
$VideoUrl = urldecode($VideoInformation['url']);
$Links[] = '<a href="'.$VideoUrl.'">'.Qualitys($VideoInformation['itag']).'</a>';
}
}
return array($Title, $Links);
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Get Youtube Video Source Links</title>
<link rel="stylesheet" type="text/css" href="Style.css" />
</head>
<body>
<?php
if(isset($_POST['TwitterProfileUrl'])){
?>
<center><h2>Get Youtube Video Source Links</h2></center>
<div class="Duzen">
<div class="GenelBilgiler">
<div class="Bilgiler Bold" style="width: 40px;">Count</div>
<div class="Bilgiler Bold KanalAdi">Video Name</div>
<div class="Bilgiler Bold SonDiv">Video Source Links</div>
<div class="Temizle"></div>
</div>
<?php
$ProfilBaglantilari = trim($_POST['TwitterProfileUrl']);
$ProfilBaglantilari = explode("\n", $ProfilBaglantilari);
$ProfilBaglantilari = array_map('trim', $ProfilBaglantilari);
foreach ($ProfilBaglantilari as $Key => $Baglanti) {
$SourceUrl = '';
$Results = GetVideoSourceUrl($Baglanti);
$Title = $Results[0];
$SourceUrller = $Results[1];
foreach ($SourceUrller as $key => $Sonuc) {
$SourceUrl .= $Sonuc.', ';
}
$SourceUrl = trim($SourceUrl, ', ');
?>
<div class="GenelBilgiler" <?=$Key%2?'':'style="background-color: #eff7ff;"'?>>
<div class="Bilgiler" style="width: 40px;"><?=($Key+1)?></div>
<div class="Bilgiler KanalAdi"><a href="<?=$Baglanti?>" target="_blank"><?=$Title?></a></div>
<div class="Bilgiler SonDiv" style="padding: 0px 5px;"><?=$SourceUrl?></div>
<div class="Temizle"></div>
</div>
<?php
}
?>
</div>
<?php
}
?>
<center><h2>Youtube Video Links</h2></center>
<div class="Duzen">
<form action="" method="post">
<label style="margin-left: 10px; margin-top: 5px; font-weight: bold; color: #474747; float: left;">Youtube Video Links</label>
<textarea placeholder="Examples: https://www.youtube.com/watch?v=vI4LHl4yFuo https://www.youtube.com/watch?v=Aia-B6_hrjo https://www.youtube.com/watch?v=3Hj3sFodt7E" name="TwitterProfileUrl" id="TwitterProfileUrl"></textarea>
<input type="submit" value="Check" id="KontrolEt">
</form>
<div class="Temizle"></div>
</div>
</body>
</html>
Style.css
*{
font-family: arial;
font-size: 14px;
}
a{
color: #666;
font-weight: bold;
margin: 3px;
}
.Duzen{
width: 852px; margin: auto; border: 1px solid #ddd; border-radius: 5px; padding: 5px 0px; margin-bottom: 50px;
}
.GenelBilgiler{
width: 842px; border-bottom: 1px solid #ddd; height: 30px; padding: 5px;
}
.Bilgiler{
width: 320px; float: left; padding: 5px; color: #474747; text-align: center; border-right: 1px solid #ddd;
}
.Temizle{
clear: both;
}
.Bold{
font-weight: bold;
}
.KanalAdi{
width: 435px; text-align: left;
}
.SonDiv{
border-right: none;
}
#TwitterProfileUrl{
width: 810px; margin: 10px; float: left; height: 250px; padding: 10px;
}
#KontrolEt{
width: 832px; margin: auto 10px; float: left; padding: 10px; border: 1px dashed #bababa; background-color: #f1f1f1; border-radius: 5px;
}
Interface;
Result;
Posted on Utopian.io - Rewarding Open Source Contributors
Your contribution cannot be approved yet. See the Utopian Rules. Please edit your contribution to reapply for approval.
The code you provide is quite simple and basic and there are a lot of tutorials and existing projects out there, related to this topic. Therefore it's difficult to evaluate your contribution.
There are also some formal/formatting issues with your post. It's always good to provide code examples right in your post but you shouldn't use images for that. It's better to use markdown to format blocks of code or just link to the code snippet on GitHub.
It's also recommended to write code only in English language. You use two different languages in your code.
To reapply for approvel, please edit your post and fix these issues. Most importantly there should be a visible effort to further improve this little project so that it becomes more unique and a real added value for users.
You may edit your post here, as shown below:
Sorry for the late review. If you wish to improve your contribution, you'll have some little extra time for that. ;)
You can contact us on Discord.
[utopian-moderator]
Edited
You fixed the formatting issues but you did not improve the content itself. I can't see
Please don't feel discouraged but my advice for you is to contribute to existing and active projects like this YouTube Downloader or this HTML GUI or even the popular youtube-dl library itself. However, if you don't have any objections, I will reject this contribution.
You can contact us on Discord.
[utopian-moderator]
Congratulations @ruhum! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of posts published
Award for the number of upvotes received
You published 4 posts in one day
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
Congratulations @ruhum! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
You got your First payout
Award for the total payout received
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
Hello my name is @eduardoff, I am new to this channel, I invite you to follow me in this community and generate a good friendship, see you soon