diff options
Diffstat (limited to 'assets')
-rw-r--r-- | assets/js/main.js | 15 | ||||
-rw-r--r-- | assets/php/getJson.php | 32 |
2 files changed, 32 insertions, 15 deletions
diff --git a/assets/js/main.js b/assets/js/main.js index 1637da2..e7f5dcf 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -22,22 +22,23 @@ $(function () { * index: 0 * movieID: 80205354 * seasonDescriptor: "Teil 1" - * series: 80192098 + * series: 80192098 // => id * seriesTitle: "Haus des Geldes" * title: "Teil 1: \"Folge 13\"" - * topNodeId: "80192098" + * topNodeId: "80192098" // === id * videoTitle: "Folge 13" */ - NetflixJson = JSON.parse(answer); + document.write(answer); + /*NetflixJson = JSON.parse(answer); console.log(NetflixJson); let IndividualTitles = []; - NetflixJson.viewedItems.forEach(function(item, key) { - const CurrentTitle = NetflixJson.viewedItems[key].seriesTitle; - if (!(CurrentTitle in IndividualTitles)) { + NetflixJson.forEach(function(item, key) { + const CurrentTitle = NetflixJson[key].seriesTitle; + if (IndividualTitles.indexOf(CurrentTitle) === -1 && CurrentTitle !== undefined) { IndividualTitles.push(CurrentTitle); } }); - console.table(IndividualTitles); + console.log(IndividualTitles);*/ }); CookieInput.val(""); diff --git a/assets/php/getJson.php b/assets/php/getJson.php index f4155e3..b72070a 100644 --- a/assets/php/getJson.php +++ b/assets/php/getJson.php @@ -1,11 +1,27 @@ <?php $NetflixCookie = $_POST["Cookie"]; -$ch = curl_init("https://www.netflix.com/api/shakti/7742b8c7/viewingactivity"); -curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); -curl_setopt($ch, CURLOPT_HEADER, 0); -curl_setopt($ch, CURLOPT_COOKIE, $NetflixCookie); -$NetflixJson = curl_exec($ch); -curl_close($ch); - -print_r($NetflixJson);
\ No newline at end of file +$LastPage = FALSE; +$CurPage = 0; +$NetflixJson = "["; + +while ($LastPage === FALSE) { + $ch = curl_init("https://www.netflix.com/api/shakti/7742b8c7/viewingactivity?pg=" . (string)$CurPage . "&pgSize=100"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_COOKIE, $NetflixCookie); + $Result = curl_exec($ch); + //echo $Result; + //echo count(json_decode(curl_exec($ch),true)["viewedItems"]); + if ($LastPage = count(json_decode($Result, TRUE)["viewedItems"][0]) > 0) { + $LastPage = FALSE; + $NetflixJson .= json_encode(json_decode($Result, TRUE)["viewedItems"][0]) . ","; + } else { + $LastPage = TRUE; + } + + curl_close($ch); + $CurPage++; +} + +print_r($NetflixJson . "]");
\ No newline at end of file |