aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/init.php18
-rw-r--r--tools/processor.php18
2 files changed, 25 insertions, 11 deletions
diff --git a/tools/init.php b/tools/init.php
index f3c39ce..baf3d9a 100644
--- a/tools/init.php
+++ b/tools/init.php
@@ -28,9 +28,23 @@ function url_exists( $url = NULL ) {
// Accept only answer 200 (Ok), 301 (permanent redirect) or 302 (temporary redirect)
$accepted_response = array( 200, 301, 302 );
if( in_array( $httpcode, $accepted_response ) ) {
- return true;
+ return TRUE;
} else {
- return false;
+ return FALSE;
+ }
+}
+
+function video_exists($url) {
+ @$headers = get_headers($url);
+ foreach ($headers as $hdr) {
+ if (preg_match('/^HTTP\/\d\.\d\s+(403)/', $hdr)){
+ $result = TRUE;
+ }
+ }
+ if ( $result = TRUE ) {
+ return FALSE; // Not exist video
+ } else {
+ return TRUE; // Exist video
}
}
diff --git a/tools/processor.php b/tools/processor.php
index 22fa1fe..efcacdb 100644
--- a/tools/processor.php
+++ b/tools/processor.php
@@ -8,7 +8,7 @@ if (empty($_GET['link'])){
$baselink = htmlspecialchars($_GET['link']);
$urlexists = url_exists( $baselink );
-if ($urlexists == true) {
+if ($urlexists == TRUE) {
// Regex - filter URL id is match[5]
$rx = '/^((?:https?:)?\/\/)? # Optional protocol
((?:www|m)[.])? # Optional sub-domain
@@ -60,8 +60,8 @@ $downloads = $video_info->formatStreams;
/* Breaking DRM!!! */
-// check standar URL
-$url_standar = url_exists($streamFormats[0]->url);
+// Check standar video into URL
+$url_standar = video_exists($streamFormats[0]->url);
// format video DRM
$formatdrm = $streamFormats[0]->type;
@@ -71,20 +71,20 @@ $node1 = "https://invidious.snopyta.org/latest_version?id={$video_id}&itag=18&lo
// explain DRM
$drmv = "https://archive.org/download/libreweb/rms-drm.webm";
-// check nodes
-$node0on = url_exists($node0);
-$node1on = url_exists($node1);
+$node0on = video_exists($node0);
+$node1on = video_exists($node1);
-if ($node0on == true) {
+// check nodes
+if ($node0on == TRUE) {
$breakurl = $node0;
-} elseif ($node1on == true) {
+} elseif ($node1on == TRUE) {
$breakurl = $node1;
} else {
$breakurl = $drmv;
$formatdrm = 'video/webm';
}
-if ($url_standar == false) {
+if ($url_standar == FALSE) {
// Liberty data
$breakquality = trim($streamFormats[0]->resolution, 'p');
$breaklink = <<<EOT