PHP Grabber

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

<?

php

include 'includes/info.php';

include 'functions/youtube-func.php';

$channelId = $_GET['id']; //Channel Id(Don't Remove This)

$url =
ngegrab('https://www.googleapis.com/youtube/v3/channels?part=snippet,statistics,branding
Settings&id='.$channelId.'&key='.$apikey.'');

$json = json_decode($url);

if($json)

foreach ($json->items as $data)

$channelTitle = $data->snippet->title;

$description = $data->snippet->description;

$total = $data->statistics->videoCount;

$title = ''.$channelTitle.'';

$ogtitle = ''.$channelTitle.' Channel';

$ogdescription = ''.$description.'';

include 'includes/head.php';

echo '<div class="header"><i class="fa fa-television"></i> '.$channelTitle.' ('.$total.')</div>';

if(strlen($_GET['page']) >1)

$yesPage=$_GET['page'];

else

$yesPage='';

}
$grab =
ngegrab('https://www.googleapis.com/youtube/v3/search?part=snippet&channelId='.$chann
elId.'&key='.$apikey.'&maxResults=10&type=video&pageToken='.$yesPage.'');

$json = json_decode($grab);

$nextpage=$json->nextPageToken;

$prevpage=$json->prevPageToken;

if($json)

foreach ($json->items as $hasil)

$id = $hasil->id->videoId;

$title = $hasil->snippet->title;

$thumbnail = $hasil->snippet->thumbnails->medium->url;

$hasil =
ngegrab('https://www.googleapis.com/youtube/v3/videos?key='.$apikey.'&part=snippet,cont
entDetails,statistics,topicDetails&id='.$id.'');

$ks = json_decode($hasil);

foreach ($ks->items as $data)

$channelTitle = $data->snippet->channelTitle;

$channelId = $data->snippet->channelId;

echo '<div class="videos_list">';

echo '<a href="/dl/'.$id.'/'.cleaned($title).'.html" rel="dofollow" title="'.$title.'">';

echo '<table>';

echo '<tbody>';

echo '<tr valign="middle">';

echo '<td>';

echo '<img src="'.$thumbnail.'" class="img" alt="'.$title.'" title="'.$title.'>';

echo '</td>';

echo '<td style="padding-left:2px;">';


echo '<div style="padding-bottom:1px;">';

echo $title;

echo '</div>';

echo '<span style="color:blue">by</span> <span


style="color:green">'.$channelTitle.'</span>';

echo '</td>';

echo '</tr>';

echo '</tbody>';

echo '</table>';

echo '</a>';

echo '</div>';

echo '<div class="pagenavi" style="text-align:center">';

if($_GET['id'])

if (strlen($prevpage)>1)

echo '<a href="/channel/'.$channelId.'/page/'.$prevpage.'" class="page_item" rel="dofollow"


title="Prev">Prev</a>';

if (strlen($nextpage)>1)

echo '<a href="/channel/'.$channelId.'/page/'.$nextpage.'" class="page_item" rel="dofollow"


title="Next">Next</a>';

echo '</div>';

include 'includes/foot.php';
?>

You might also like