Skip to content

Commit

Permalink
Version: plugin.video.retrospect-5.7.21.
Browse files Browse the repository at this point in the history
  • Loading branch information
basrieter committed Dec 5, 2024
1 parent 50c18c1 commit b454b28
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
12 changes: 4 additions & 8 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
[B]Retrospect v5.7.21 - Changelog - 2024-11-26[/B]
[B]Retrospect v5.7.xx - Changelog - 2024-xx-xx[/B]

Fixed some minor channel issues for Dutch and Swedish channels.
t.b.d.

[B]Framework related[/B]
* Added: Patch option to UriHandler.
_None_

[B]GUI/Settings/Language related[/B]
_None_

[B]Channel related[/B]
* Fixed: NPO Plus content not showing (Fixes #1862).
* Fixed: Some TV4 content (with encryption) was not playing (Fixes #1853).
* Fixed: Revoking a device from Videoland.nl broke Retrospect listing (Fixes #1852).
* Fixed: BVN Images did not show (Fixes #1864).
* Fixed: Don't use HVEC for SVT (Fixes #1865).
* Fixed: NPO 'Recent' items broke if there were too many season results (Fixes #1871).
18 changes: 17 additions & 1 deletion channels/channel.nos/nos2010/chn_nos2010.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ def __init__(self, channel_info: ChannelInfo):
parser=[], creator=self.create_api_season_item,
updater=self.update_epg_series_item)

self._add_data_parser(
"https://npo.nl/start/serie/",
name="Direct link to video", json=True,
updater=self.update_nextjs_video
)

self._add_data_parsers([
"https://npo.nl/start/api/domain/programs-by-season",
"https://npo.nl/start/api/domain/programs-by-series"],
Expand Down Expand Up @@ -777,8 +783,10 @@ def create_api_epg_item(self, result_set: dict) -> Optional[MediaItem]:
program_slug = result_set["program"]["slug"]
url = f"https://npo.nl/start/video/{program_slug}"
elif series_slug and program_guid:
url = f"https://npo.nl/start/api/domain/series-seasons?slug={series_slug}"
program_slug = result_set["program"]["slug"]
season_slug = result_set["season"]["slug"]
# url = f"https://npo.nl/start/api/domain/series-seasons?slug={series_slug}"
url = f"https://npo.nl/start/serie/{series_slug}/{season_slug}/{program_slug}"
else:
return None

Expand Down Expand Up @@ -846,6 +854,14 @@ def update_epg_series_item(self, item: MediaItem) -> MediaItem:

return self.__update_video_item(item, product_id)

def update_nextjs_video(self, item: MediaItem) -> MediaItem:
data = UriHandler.open(item.url)
next_js_data = Regexer.do_regex(r"__NEXT_DATA__[^>]+>(.+?)</script>", data)[0]
next_js_json = JsonHelper(next_js_data)
data = next_js_json.get_value("props", "pageProps", "dehydratedState", "queries", -1, "state", "data")
p = [p for p in data if p["guid"] == item.metaData["program_guid"]][0]
return self.__update_video_item(item, p["productId"])

# noinspection PyUnusedLocal
def search_site(self, url: Optional[str] = None, needle: Optional[str] = None) -> List[MediaItem]:
""" Creates a list of items by searching the site.
Expand Down
10 changes: 10 additions & 0 deletions tests/channel_tests/test_chn_nos2010.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ def test_series_with_seasons_via_slug(self):
self.assertGreaterEqual(len(items), 1)
self.assertGreaterEqual(len([i for i in items if i.is_playable]), 1)

def test_update_next_js(self):
from resources.lib.mediaitem import MediaItem
url = "https://npo.nl/start/serie/nos-journaal-20-00-uur/seizoen-61/nos-journaal_96627"
item = MediaItem("Video via NextJS", url)
item.metaData["program_guid"] = "7917478b-8750-498f-8ced-dc6548ef2612"

item = self.channel.process_video_item(item)
self.assertTrue(item.has_streams())
self.assertTrue(item.complete)

def test_series_recent_episodes_via_guid(self):
self._test_folder_url("https://npo.nl/start/api/domain/programs-by-series?seriesGuid=af032e71-3047-4b22-aac9-c2ef9c8bb9a3&limit=20&sort=-firstBroadcastDate", 2)

Expand Down

0 comments on commit b454b28

Please sign in to comment.