aboutsummaryrefslogtreecommitdiffstats
path: root/tools/processor.php
diff options
context:
space:
mode:
Diffstat (limited to 'tools/processor.php')
-rw-r--r--tools/processor.php29
1 files changed, 21 insertions, 8 deletions
diff --git a/tools/processor.php b/tools/processor.php
index cff5392..6792943 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
@@ -58,15 +58,28 @@ $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])){
+/* Breaking DRM!!! */
+$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);
+
+if ($node0on == true) {
+ $breakurl = $node0;
+} elseif ($node1on == true) {
+ $breakurl = $node1;
+}
+
+// check standar URL
+$url_drm = breakdrm($streamFormats[0]->url);
+
+if ($url_drm == false) {
// Liberty data
$breakquality = trim($streamFormats[0]->resolution, 'p');
- $breakurl = "https://invidious.snopyta.org/latest_version?id={$video_id}&itag=18&local=true";
$breaklink = <<<EOT
- <source data-res="{$breakquality}" src="{$breakurl}" type='{$streamFormats[0]->type}'/>
+<source data-res="{$breakquality}" src="{$breakurl}" type='{$streamFormats[0]->type}'/>
EOT;
$downloadFormat = $downloads[0]->container;
$downloadQuality = $streamFormats[0]->resolution;
@@ -83,7 +96,7 @@ EOT;
$breaklink = '';
$breakdownload = '';
}
-// End Breaking DRM!!!
+/* End Breaking DRM!!! */
// // Captions
// $streamCaptions = $video_info->captions;