From dfa6d36a6edd5ad5190acf3401bad43480f8bcc0 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 16 May 2021 10:35:56 +0200 Subject: Fixed several things --- assets/php/getData.php | 67 +++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 33 deletions(-) (limited to 'assets/php') diff --git a/assets/php/getData.php b/assets/php/getData.php index f20b110..c392fc5 100755 --- a/assets/php/getData.php +++ b/assets/php/getData.php @@ -1,50 +1,51 @@ 0)) { - $isLastPage = false; - $result .= json_encode(json_decode($answer, true)['viewedItems']) . ','; - } else { - $isLastPage = true; - $result = substr($result, 0, -1); - } - - curl_close($ch); - $currentPage++; - } + print_r(file_get_contents("../../debug.json")); + die(); +} - if ($result !== '') { - print_r($result . ']'); - } else { - http_response_code(404); - die(); - } -} else { +if (!isset($cookie)) { http_response_code(404); die(); } +$isLastPage = false; +$currentPage = 0; +$result = '['; + +while ($isLastPage === false) { + // Anywhere on netflix.com in console: netflix.appContext.state.model.models.serverDefs.data.BUILD_IDENTIFIER + $ch = curl_init('https://www.netflix.com/shakti/vbe1263cd/viewingactivity?pg=' . $currentPage . '&pgSize=100'); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_COOKIE, $cookie); + $answer = curl_exec($ch); + curl_close($ch); + + if ($isLastPage = (count(json_decode($answer, true)['viewedItems']) > 0)) { + $isLastPage = false; + $result .= json_encode(json_decode($answer, true)['viewedItems']) . ','; + } else { + $isLastPage = true; + $result = substr($result, 0, -1); + } + $currentPage++; +} +if ($result !== '') { + print_r($result . ']'); +} else { + http_response_code(404); + die(); +} -- cgit v1.2.3