-
Notifications
You must be signed in to change notification settings - Fork 4
/
example2.php
103 lines (96 loc) · 3.21 KB
/
example2.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
header("Access-Control-Allow-Origin: *");
error_reporting(E_ALL & ~E_DEPRECATED);
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
include_once("../yt.php");
$yt = new YT();
/**
* -----------------------------------
* AUTHORIZATION
* -----------------------------------
*/
$env = parse_ini_file('.env');
$authorization = $env['AUTHORIZATION'];
$cookie = $env['COOKIE'];
$yt->setAuthorization($authorization);
$yt->setCookie($cookie);
// ------------------------------------
if (isset($_GET["download"])) {
$vid_id = $_GET["download"];
echo response(200, 'ok', $yt->getDownloadURL($vid_id));
}
if (isset($_GET["videoInfo"])) {
$vid_id = $_GET["videoInfo"];
echo response(200, 'ok', $yt->getVideo($vid_id));
}
if (isset($_GET["search_query"])) {
$Query = $_GET["search_query"];
echo response(200, 'ok', $yt->search($Query));
}
if (isset($_GET["recomended"])) {
echo response(200, 'ok', $yt->HomePageVideos());
}
if (isset($_GET["relatedVideos"])) {
$videoId = $_GET["relatedVideos"];
echo response(200, 'ok', $yt->getRelatedVideo($videoId));
}
if (isset($_GET["channel_detail"])) {
$channelId = $_GET["channel_detail"];
echo response(200, 'ok', $yt->getChannelMetaDetails($channelId));
}
if (isset($_GET["channel_feature"])) {
$channelId = $_GET["channel_feature"];
echo response(200, 'ok', $yt->getChannelFeatured($channelId));
}
if (isset($_GET["channel_live"])) {
$channelId = $_GET["channel_live"];
echo response(200, 'ok', $yt->getChannelLive($channelId));
}
if (isset($_GET["channel_community"])) {
$channelId = $_GET["channel_community"];
echo response(200, 'ok', $yt->getChannelCommunity($channelId));
}
if (isset($_GET["channel_videos"])) {
$channelId = $_GET["channel_videos"];
echo response(200, 'ok', $yt->getChannelVideos($channelId));
}
if (isset($_GET["channel_videos_next"])) {
$nextToken = $_GET["channel_videos_next"];
echo response(200, 'ok', $yt->getChannelVideosNext($nextToken));
}
if (isset($_GET["channel_about"])) {
$channelId = $_GET["channel_about"];
echo response(200, 'ok', $yt->getChannelAbout($channelId));
}
if (isset($_GET["channel_shorts"])) {
$channelId = $_GET["channel_shorts"];
echo response(200, 'ok', $yt->getChannelShorts($channelId));
}
if (isset($_GET["channel_playlist"])) {
$channelId = $_GET["channel_playlist"];
echo response(200, 'ok', $yt->getChannelPlayList($channelId));
}
if (isset($_GET["getComments"])) {
echo response(200, 'ok', $yt->getComments($_GET["getComments"]));
}
if (isset($_GET["getReplyComments"])) {
echo response(200, 'ok', $yt->getReplyComments($_GET["getReplyComments"]));
}
if (isset($_GET["getSearchNext"])) {
echo response(200, 'ok', $yt->getSearchNext($_GET["getSearchNext"]));
}
if (isset($_GET["recomendedAuth"])) {
echo response(200, 'ok', $yt->HomePageVideosWithAuth());
}
if (isset($_GET["getHomeNext"])) {
echo response(200, 'ok', $yt->HomePageVideosNext($_GET["getHomeNext"]));
}
function response($status, $status_message, $data)
{
header("HTTP/1.1 " . $status);
$response['status'] = $status;
$response['status_message'] = $status_message;
$response['data'] = $data;
$json_response = json_encode($response);
echo $json_response;
}