aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2019-05-24 22:20:12 -0500
committerJesús <heckyel@hyperbola.info>2019-05-24 22:20:12 -0500
commit56720b89a7fe28ee143dc9f36b4cc29a5ad63acb (patch)
treeafc7d665354debcd814147e6e88b2434b024d327
parentc3b9696db75054ac02a9da4447836215e19b6232 (diff)
downloadytlibre-56720b89a7fe28ee143dc9f36b4cc29a5ad63acb.tar.lz
ytlibre-56720b89a7fe28ee143dc9f36b4cc29a5ad63acb.tar.xz
ytlibre-56720b89a7fe28ee143dc9f36b4cc29a5ad63acb.zip
refactoring extractor and validator URL
-rw-r--r--tools/init.php10
-rw-r--r--tools/processor.php8
2 files changed, 4 insertions, 14 deletions
diff --git a/tools/init.php b/tools/init.php
index c23d5c9..f3c39ce 100644
--- a/tools/init.php
+++ b/tools/init.php
@@ -49,13 +49,3 @@ function bytes($a) {
}
return number_format($a,($c ? 2 : 0),",",".")." ".$unim[$c];
}
-
-// Check, if there is not content into URL return 'false'
-function breakdrm($url) {
- @$headers = get_headers($url);
- if (preg_match('/^HTTP\/\d\.\d\s+(403)/', $headers[0])){
- return false;
- } else {
- return true;
- }
-}
diff --git a/tools/processor.php b/tools/processor.php
index 6792943..5063c35 100644
--- a/tools/processor.php
+++ b/tools/processor.php
@@ -63,8 +63,8 @@ $node0 = "https://invidio.us/latest_version?id={$video_id}&itag=18&local=true";
$node1 = "https://invidious.snopyta.org/latest_version?id={$video_id}&itag=18&local=true";
// check nodes
-$node0on = breakdrm($node0);
-$node1on = breakdrm($node1);
+$node0on = url_exists($node0);
+$node1on = url_exists($node1);
if ($node0on == true) {
$breakurl = $node0;
@@ -73,9 +73,9 @@ if ($node0on == true) {
}
// check standar URL
-$url_drm = breakdrm($streamFormats[0]->url);
+$url_standar = url_exists($streamFormats[0]->url);
-if ($url_drm == false) {
+if ($url_standar == false) {
// Liberty data
$breakquality = trim($streamFormats[0]->resolution, 'p');
$breaklink = <<<EOT