blob: 591887343dd460e1f982cbfd6ce16816f7e95bfb (
plain)
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
|
<?php
require_once "init.php";
if ( empty( $_GET['link'] ) ){
header( 'Location: index.php' );
}
$baselink = htmlspecialchars( $_GET['link'] );
$urlexists = url_exists( $baselink );
if ( $urlexists === TRUE ) {
// Regex - filter URL id is match[5]
$rx = '/^((?:https?:)?\/\/)? # Optional protocol
((?:www|m)[.])? # Optional sub-domain
((?:youtube[.]com|
youtu[.]be|
invidio[.]us|
invidiou[.]sh|
invidious[.]kabi[.]tk|
invidious[.]glie[.]town|
invidious[.]zapashcanon[.]fr|
yotter[.]conocimientoslibres[.]ga|
invidious[.]snopyta[.]org)) # URL supports
(\/(?:[\w\-]+\?v=|embed\/|v\/)?) # Parameters (embed, v)
([\w\-]+) # Video id of 11
(\S+)?$/mx';
preg_match( $rx, $baselink, $match );
// Testing if id → 11 characters
if ( strlen( $match[5] ) == 11 ) {
$video_id = $match[5];
} else {
header( 'Location: index.php' );
}
} else {
header( 'Location: index.php' );
}
// Core API
require_once "extract.php";
$videoTitle=$vidtitle;
$videoThumbURL = "https://i.ytimg.com/vi/{$video_id}/hqdefault.jpg";
$videoDuration = secToDuration($vidtime);
$videoViews = bytes( $vidviewCount );
$islive = $vidisLiveContent;
if (!empty($vdef)) {
$streamFormats = $vdef;
$streamFormatsExtra = $vid;
$streamExtra = TRUE;
} else {
$streamFormats = $vid;
$streamExtra = FALSE;
}
$videoAuthor = $vidauthor;
/* ---- ---- Generated URL and embed ---- ---- */
if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {
$pro = 'https';
} else {
$pro = 'http';
}
$subject = $pro."://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
// Local URL
$local_url = preg_replace( '/index.php/', '', $subject );
/* ---- ---- URL Query ---- ---- */
$url_query = "{$baselink}";
|