From: James Bunton Date: Tue, 12 Feb 2019 11:21:54 +0000 (+1100) Subject: SBS now has a maximum query range of 49 X-Git-Url: https://code.delx.au/webdl/commitdiff_plain/8c49f0ff2a004225bbb02dd9f8772440dd3d7db0 SBS now has a maximum query range of 49 --- diff --git a/sbs.py b/sbs.py index 043e630..dc353ca 100644 --- a/sbs.py +++ b/sbs.py @@ -2,6 +2,7 @@ import requests_cache from common import grab_html, grab_json, grab_xml, download_hls, download_mpd, Node, append_to_qs import json +import sys BASE = "https://www.sbs.com.au" FULL_VIDEO_LIST = BASE + "/api/video_search/v2/?m=1&filters={section}{Programs}" @@ -76,7 +77,7 @@ class SbsRootNode(SbsNavNode): def load_all_video_entries(self): offset = 1 - amount = 500 + amount = 49 while True: url = append_to_qs(FULL_VIDEO_LIST, {"range": "%s-%s" % (offset, offset+amount)}) data = grab_json(url) @@ -88,6 +89,9 @@ class SbsRootNode(SbsNavNode): for entry in entries: yield entry offset += amount + sys.stdout.write(".") + sys.stdout.flush() + print() def explode_videos_to_unique_categories(self, all_video_entries): for entry_data in all_video_entries: