From 8cd5713c496aff7f2f5880c01562627da1d7f156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Sat, 16 Jan 2021 00:04:21 -0500 Subject: Fix json_encode and add size --- index.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index cf9d396..2ab73e8 100644 --- a/index.php +++ b/index.php @@ -470,7 +470,8 @@ if (isset($_GET['id'])) { 'fps' => $stream['fps'], 'resolution' => $stream['qualityLabel'], 'qualityLabel' => $stream['qualityLabel'], - 'format' => exformat($stream['itag']) + 'format' => exformat($stream['itag']), + 'size' => $stream['width'].'x'.$stream['height'], ); array_push($vdef, $values); } else { @@ -500,6 +501,7 @@ if (isset($_GET['id'])) { 'resolution' => $stream['qualityLabel'], 'qualityLabel' => $stream['qualityLabel'], 'format' => exformat($stream['itag']), + 'size' => $stream['width'].'x'.$stream['height'], ); array_push($vid, $values); } @@ -537,13 +539,14 @@ if (isset($_GET['id'])) { 'resolution' => $stream['qualityLabel'], 'qualityLabel' => $stream['qualityLabel'], 'format' => exformat($stream['itag']), + 'size' => $stream['width'].'x'.$stream['height'], ); array_push($vid, $values); } } } $json['adaptiveFormats'] = array_merge($vid, $aud); - $json['formatStreams']=$vdef; + $json['formatStreams'] = $vdef; // $json['audio']=$aud; // $json['video']=$vid; } else { @@ -552,12 +555,12 @@ if (isset($_GET['id'])) { $vid = array(); $json['adaptiveFormats'] = array_merge($vid, $aud); - $json['formatStreams']=$vdef; + $json['formatStreams'] = $vdef; // $json['audio']=$aud; // $json['video']=$vid; } - - echo json_encode($json, JSON_FORCE_OBJECT); + // echo json_encode($json, JSON_FORCE_OBJECT); + echo json_encode($json); // echo json_encode($streamin_data_json, JSON_FORCE_OBJECT); } else { $json = array( -- cgit v1.2.3