This repository has been archived by the owner on Jan 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathprofile.php
executable file
·53 lines (47 loc) · 2.23 KB
/
profile.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
<?php
require __DIR__ . "/vendor/autoload.php";
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
$loader = new FilesystemLoader(__DIR__ . "/templates");
$twig = new Environment($loader);
include("includes/youtubei/browse.php");
include("includes/config.inc.php");
if (!isset($_GET['id'])) {
echo "Please enter a channel ID";
} else {
$id = $_GET['id'];
$mainResponseObject = json_decode(requestChannel($id, "about"));
// check for some channels that are "special" in that they dont have the date as other channels would normally do.
if (isset($mainResponseObject->contents->twoColumnBrowseResultsRenderer->tabs[4]->tabRenderer->content->sectionListRenderer->contents[0]->itemSectionRenderer->contents[0]->channelAboutFullMetadataRenderer)) {
$metadata = $mainResponseObject->contents->twoColumnBrowseResultsRenderer->tabs[4]->tabRenderer->content->sectionListRenderer->contents[0]->itemSectionRenderer->contents[0]->channelAboutFullMetadataRenderer;
$cDetails = array(
"name" => $metadata->title->simpleText,
"description" => "N/A",
"thumbnail" => $metadata->avatar->thumbnails[0]->url,
"joined" => $metadata->joinedDateText->runs[1]->text, // currently not implemented, will find some way to add in this shit
"rss" => "https://www.youtube.com/feeds/videos.xml?channel_id=" . $id,
);
if (isset($metadata->description->simpleText)) {
$cDetails["description"] = $metadata->description->simpleText;
}
} else {
$metadata = $mainResponseObject->metadata->channelMetadataRenderer;
$cDetails = array(
"name" => $metadata->title,
"description" => $metadata->description,
"thumbnail" => $metadata->avatar->thumbnails[0]->url,
"joined" => "N/A", //$metadata->joinedDateText->runs[1]->text,
"rss" => "https://www.youtube.com/feeds/videos.xml?channel_id=" . $id,
);
}
echo $twig->render(
"profile.html.twig",
[
"id" => $id,
"name" => $cDetails['name'],
"description" => $cDetails['description'],
"rss" => $cDetails['rss']
]
);
}
// ok now go to the HTML section below........