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
|
<?php
require_once "init.php";
if (empty($_GET['link'])){
header('Location: index.php');
}
$baselink = htmlspecialchars($_GET['link']);
$yturl = 'youtu.be/';
if (strpos($baselink,$yturl) !== false){
$link = preg_replace('~^https?://youtu\.be/([a-z\d]+)$~i', 'https://www.youtube.com/watch?v=$1', $baselink);
} else {
$link = $baselink;
}
parse_str($link, $urlData);
$video_id = array_values($urlData)[0];
$video_string = file_get_contents("https://invidio.us/api/v1/videos/{$video_id}");
$video_info = json_decode($video_string);
$videoTitle = $video_info->title;
$videoAuthor = $video_info->author;
$videoDurationSecs = $video_info->lengthSeconds;
$videoDuration = secToDuration($videoDurationSecs);
$videoChannel = $video_info->author;
// Begin_ViewCount
$extract_video_view = $video_info->viewCount;
function bytes($a) {
$unim = array("","K","M","G","T","P");
$c = 0;
while ($a>=1000) {
$c++;
$a = $a/1000;
}
return number_format($a,($c ? 2 : 0),",",".")." ".$unim[$c];
}
$videoViews = bytes($extract_video_view);
// End_ViewCount
// change hqdefault.jpg to default.jpg for downgrading the thumbnail quality
$videoThumbURL = "https://i1.ytimg.com/vi/{$video_id}/hqdefault.jpg";
$librethumb = $video_info->videoThumbnails[0]->url;
// Extract videos from JSON
$streamFormats = $video_info->formatStreams;
// Downloads
$downloads = $video_info->formatStreams;
// Breaking DRM!!!
$url_drm = $streamFormats[0]->url;
@$headers = get_headers($url_drm);
if (preg_match('/^HTTP\/\d\.\d\s+(403)/', $headers[0])){
// Liberty data
$breakquality = trim($streamFormats[0]->resolution, 'p');
$breakurl = "https://invidio.us/latest_version?id={$video_id}&itag=18&local=true";
$breaklink = <<<EOT
<source data-res="{$breakquality}" src="{$breakurl}" type='{$streamFormats[0]->type}'/>
EOT;
$downloadFormat = $downloads[0]->container;
$downloadQuality = $streamFormats[0]->resolution;
$breakdownload = <<<EOT
<div class="row">
<div class="col">{$downloadFormat}</div>
<div class="col">{$downloadQuality}</div>
<div class="col">
<a class="boton-descarga" href="{$breakurl}" download>Descarga Habilitada</a>
</div>
</div>
EOT;
} else {
$breaklink = '';
$breakdownload = '';
}
// End Breaking DRM!!!
// // Captions
// $streamCaptions = $video_info->captions;
|