From 51e86a9be4acab79566cb34d51ff5d872ae751f9 Mon Sep 17 00:00:00 2001 From: Amined9 Date: Tue, 17 Sep 2024 23:25:33 +0200 Subject: [PATCH] request-adjustment --- movies_list.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/movies_list.py b/movies_list.py index 1e7ff59..5171d99 100644 --- a/movies_list.py +++ b/movies_list.py @@ -5,6 +5,7 @@ import shutil import string import subprocess +import json import requests from PySide6.QtCore import ( @@ -421,17 +422,23 @@ def do_handshake(self, url, mac, serverload="/server/load.php", load=True): return self.do_handshake(url, mac, serverload) print("Error in handshake:", e) return False - + def load_stb_movies(self, url, options): url = URLObject(url) url = f"{url.scheme}://{url.netloc}" - page = 0 + Allmovies = [] try: - fetchurl = f"{url}/server/load.php?type=vod&action=get_ordered_list&genre=0&category=*&p={page}&sortby=added" + fetchurl = f"{url}/server/load.php?type=vod&action=get_ordered_list" response = requests.get(fetchurl, headers=options["headers"]) result = response.json() - movies = result["js"]["data"] - self.display_movies(movies) + length = int(result["js"]["total_items"] / result["js"]["max_page_items"]) + for i in range(length): + fetchurl = f"{url}/server/load.php?type=vod&action=get_ordered_list&genre=0&category=*&p={i}&sortby=added" + response = requests.get(fetchurl, headers=options["headers"]) + result = response.json() + movies = result["js"]["data"] + Allmovies += movies + self.display_movies(Allmovies) self.config["data"][self.config["selected"]]["options"] = options self.config["data"][self.config["selected"]]["movies"] = movies self.save_config()