-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
82 lines (78 loc) · 2.29 KB
/
search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
include 'inc/func.php';
include 'inc/info.php';
if($_GET['q'])
{
$q = $_GET['q'];
$qu=$q;
}
$title ='Search For '.$q.' to 3GP, MP4, FLV, WEBM, HD and MP3 Format Download - '.$sitename.'';
include 'inc/head.php';
echo '<div><h3>Results: '.$q.'</h3></div>';
$qu=$q;
$qu=str_replace(" ","+", $qu);
$qu=str_replace("-","+", $qu);
$qu=str_replace("_","+", $qu);
if(strlen($_GET['page']) >1)
{
$yesPage=$_GET['page'];
}
else
{
$yesPage='';
}
$grab=ngegrab('https://www.googleapis.com/youtube/v3/search?part=snippet&order=relevance®ionCode=lk&q='.$qu.'&key='.$key.'&maxResults=20&pageToken='.$yesPage.'&type=video');
$json = json_decode($grab);
$nextpage=$json->nextPageToken;
$prevpage=$json->prevPageToken;
if($json)
{
foreach ($json->items as $hasil)
{
$id = $hasil->id->videoId;
$name = $hasil->snippet->title;
$ud = strtolower("$ln");
$description = $hasil->snippet->description;
$channel = $hasil->snippet->channelTitle;
$channelid = $hasil->snippet->channelId;
$addedon = dateyt($hasil->snippet->publishedAt);
$hasil = ngegrab('https://www.googleapis.com/youtube/v3/videos?key='.$key.'&part=contentDetails,statistics&id='.$id.'');
$dt = json_decode($hasil);
foreach ($dt->items as $dta)
{
$time = $dta->contentDetails->duration;
$duration = format_time($time);
$views = $dta->statistics->viewCount;
$likes = $dta->statistics->likeCount;
$dislikes = $dta->statistics->dislikeCount;
}
echo '<ul class="itemlist"><li><div class="thumb"><img src="http://ytimg.googleusercontent.com/vi/'.$id.'/mqdefault.jpg" alt="'.$id.'" width="60px" height="55px" alt="'.$id.'"/></div><div class="meta"><a href="/watch?v='.$id.'" title="'.$name.'"><b>'.$name.'</b></a><br/>By '.$channel.'</div></li></ul>';
}
echo '<li class="paging">';
if (strlen($prevpage)>1)
{
if (strlen($qu)>1)
{
echo '<a href="/search.php?q='.$qu.'&page='.$prevpage.'" class="page" title="Previous Page">Prev</a>';
}
}
if (strlen($nextpage)>1)
{
if (strlen($qu)>1)
{
echo '<a href="/search.php?q='.$qu.'&page='.$nextpage.'" style="float:right;" title="Next Page">Next</a>';
}
}
echo '</li>';
}
if(!empty($qu) AND empty($_GET['utm_token']))
{
$user_query = ''.$qu.'';
write_to_file($user_query);
}
echo '<div class="tags">
ads here
</div>';
include 'recent_search.php';
include 'inc/foot.php';
?>