aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2020-12-11 22:32:47 -0500
committerJesús <heckyel@hyperbola.info>2020-12-11 22:32:47 -0500
commitd8ffb077e1fc29ed385ccc15e5e09a5b1054efe9 (patch)
treedb9c4c3667f1442e08f71af58463d9246a1c8e3c
parent85dd7d2580277d5092033877ee6f7be3106ca270 (diff)
downloadytlibre-d8ffb077e1fc29ed385ccc15e5e09a5b1054efe9.tar.lz
ytlibre-d8ffb077e1fc29ed385ccc15e5e09a5b1054efe9.tar.xz
ytlibre-d8ffb077e1fc29ed385ccc15e5e09a5b1054efe9.zip
Fix Undefined variable
-rw-r--r--tools/extract.php121
-rw-r--r--tools/processor.php1
2 files changed, 68 insertions, 54 deletions
diff --git a/tools/extract.php b/tools/extract.php
index 2f82387..97cad90 100644
--- a/tools/extract.php
+++ b/tools/extract.php
@@ -425,38 +425,84 @@ if ( isset($streamin_data_json["videoDetails"]["keywords"]) ) {
// streams
if (isset($streamin_data_json["streamingData"])) {
- $strF=$streamin_data_json["streamingData"]["formats"];
- $strA=$streamin_data_json["streamingData"]["adaptiveFormats"];
+ if (isset($streamin_data_json["streamingData"]["formats"])) {
+ $strF=$streamin_data_json["streamingData"]["formats"];
+ }
+
+ if (isset($streamin_data_json["streamingData"]["adaptiveFormats"])) {
+ $strA=$streamin_data_json["streamingData"]["adaptiveFormats"];
+ }
$vdef = array();
- foreach ($strF as $stream) {
- if (isset($stream["signatureCipher"])) {
- parse_str($stream["signatureCipher"],$dturl);
- $values = array(
- 'url' => $dturl['url'].'&sig='.sig($dturl['s']),
- 'itag' => $stream['itag'],
- 'type' => $stream['mimeType'],
- 'quality' => $stream['quality'],
- 'fps' => $stream['fps'],
- 'resolution' => $stream['qualityLabel'],
- 'qualityLabel' => $stream['qualityLabel'],
- 'format' => exformat($stream['itag'])
- );
- array_push($vdef, $values);
- } else {
- if (!empty($strF['url'])) {
+ if (isset($strF)) {
+ foreach ($strF as $stream) {
+ if (isset($stream["signatureCipher"])) {
+ parse_str($stream["signatureCipher"],$dturl);
$values = array(
- 'url' => $strF['url'],
+ 'url' => $dturl['url'].'&sig='.sig($dturl['s']),
+ 'itag' => $stream['itag'],
+ 'type' => $stream['mimeType'],
+ 'quality' => $stream['quality'],
+ 'fps' => $stream['fps'],
+ 'resolution' => $stream['qualityLabel'],
+ 'qualityLabel' => $stream['qualityLabel'],
+ 'format' => exformat($stream['itag'])
);
array_push($vdef, $values);
+ } else {
+ if (!empty($strF['url'])) {
+ $values = array(
+ 'url' => $strF['url'],
+ );
+ array_push($vdef, $values);
+ }
}
}
}
+
$aud = array();
$vid = array();
- foreach ($strF as $stream) {
- if (isset( $stream['url'] )) {
+ if (isset($strF)) {
+ foreach ($strF as $stream) {
+ if (isset( $stream['url'] )) {
+ if (preg_match('/video/', $stream['mimeType'])) {
+ $url = $stream['url'];
+ $values = array(
+ 'url' => $url,
+ 'itag' => $stream['itag'],
+ 'type' => $stream['mimeType'],
+ 'quality' => $stream['quality'],
+ 'fps' => $stream['fps'],
+ 'resolution' => $stream['qualityLabel'],
+ 'qualityLabel' => $stream['qualityLabel'],
+ 'format' => exformat($stream['itag']),
+ );
+ array_push($vid, $values);
+ }
+ }
+ }
+ }
+
+ if (isset($strA)) {
+ foreach ($strA as $stream) {
+ if (isset($stream["signatureCipher"])) {
+ parse_str($stream["signatureCipher"],$dturl);
+ $stream['url']=$dturl['url'].'&sig='.sig($dturl['s']);
+ }
+
+ if (preg_match('/audio/', $stream['mimeType'])) {
+ $url = $stream['url'];
+ $values = array(
+ 'url' => $url,
+ 'itag' => $stream['itag'],
+ 'type' => $stream['mimeType'],
+ 'quality' => $stream['quality'],
+ 'format' => exformat($stream['itag']),
+ );
+ array_push($aud, $values);
+ }
+
if (preg_match('/video/', $stream['mimeType'])) {
$url = $stream['url'];
$values = array(
@@ -473,39 +519,6 @@ if (isset($streamin_data_json["streamingData"])) {
}
}
}
- foreach ($strA as $stream) {
- if (isset($stream["signatureCipher"])) {
- parse_str($stream["signatureCipher"],$dturl);
- $stream['url']=$dturl['url'].'&sig='.sig($dturl['s']);
- }
-
- if (preg_match('/audio/', $stream['mimeType'])) {
- $url = $stream['url'];
- $values = array(
- 'url' => $url,
- 'itag' => $stream['itag'],
- 'type' => $stream['mimeType'],
- 'quality' => $stream['quality'],
- 'format' => exformat($stream['itag']),
- );
- array_push($aud, $values);
- }
-
- if (preg_match('/video/', $stream['mimeType'])) {
- $url = $stream['url'];
- $values = array(
- 'url' => $url,
- 'itag' => $stream['itag'],
- 'type' => $stream['mimeType'],
- 'quality' => $stream['quality'],
- 'fps' => $stream['fps'],
- 'resolution' => $stream['qualityLabel'],
- 'qualityLabel' => $stream['qualityLabel'],
- 'format' => exformat($stream['itag']),
- );
- array_push($vid, $values);
- }
- }
} else {
$vdef = array();
diff --git a/tools/processor.php b/tools/processor.php
index 5918873..d442234 100644
--- a/tools/processor.php
+++ b/tools/processor.php
@@ -52,6 +52,7 @@ if (!empty($vdef)) {
} else {
$streamFormats = $vid;
$streamExtra = FALSE;
+ $streamFormatsExtra = NULL;
}
$videoAuthor = $vidauthor;