@@ -86,25 +86,25 @@ def __init__(self, channel_info: ChannelInfo):
8686
8787 # If the user was logged in, we need to refresh the token otherwise it will result in 403
8888 self ._add_data_parsers ([
89- "https://npo.nl/start/api/domain/page-collection?guid =" ,
90- "https://npo.nl/start/api/domain/page-collection?type=series&guid =" ,
91- "https://npo.nl/start/api/domain/search-results ?searchType=series" ],
89+ "https://npo.nl/start/api/domain/page-collection?collectionId =" ,
90+ "https://npo.nl/start/api/domain/page-collection?type=series&collectionId =" ,
91+ "https://npo.nl/start/api/domain/search-collection-items ?searchType=series" ],
9292 name = "Collections with series" , json = True ,
9393 requires_logon = bool (self .__user_name ),
9494 parser = ["items" ],
9595 creator = self .create_api_program_item )
9696 # Use the new `label` options for the collections
9797 self ._add_data_parser (
98- "https://npo.nl/start/api/domain/recommendation-collection?key =" , name = "Collection with series" ,
98+ "https://npo.nl/start/api/domain/recommendation-collection?partyId=1&collectionId =" , name = "Collection with series" ,
9999 json = True , label = "collection-with-series" ,
100100 requires_logon = bool (self .__user_name ),
101101 parser = ["items" ],
102102 creator = self .create_api_program_item )
103103
104104 # If the user was logged in, we need to refresh the token otherwise it will result in 403
105105 self ._add_data_parsers ([
106- "https://npo.nl/start/api/domain/search-results ?searchType=broadcasts" ,
107- "https://npo.nl/start/api/domain/page-collection?type=program&guid ="
106+ "https://npo.nl/start/api/domain/search-collection-items ?searchType=broadcasts" ,
107+ "https://npo.nl/start/api/domain/page-collection?type=program&collectionId ="
108108 ],
109109 name = "Collections with videos" , json = True ,
110110 requires_logon = bool (self .__user_name ),
@@ -113,7 +113,7 @@ def __init__(self, channel_info: ChannelInfo):
113113 )
114114 # Use the new `label` options for the collections
115115 self ._add_data_parser (
116- "https://npo.nl/start/api/domain/recommendation-collection?key =" , name = "Collection with videos" ,
116+ "https://npo.nl/start/api/domain/recommendation-collection?partyId=1&collectionId =" , name = "Collection with videos" ,
117117 json = True , label = "collection-with-videos" ,
118118 requires_logon = bool (self .__user_name ),
119119 parser = ["items" ],
@@ -147,11 +147,11 @@ def __init__(self, channel_info: ChannelInfo):
147147 requires_logon = bool (self .__user_name ),
148148 updater = self .update_video_item )
149149
150- self ._add_data_parser ("https://npo.nl/start/api/domain/page-layout?slug =" ,
150+ self ._add_data_parser ("https://npo.nl/start/api/domain/page-layout?layoutId =" ,
151151 name = "Bare pages layout" , json = True ,
152152 parser = ["collections" ], creator = self .create_api_page_layout )
153153
154- self ._add_data_parser ("https://npo.nl/start/api/domain/page-collection?type=dynamic_page&guid =" ,
154+ self ._add_data_parser ("https://npo.nl/start/api/domain/page-collection?type=dynamic_page&collectionId =" ,
155155 name = "Categories layout" , json = True ,
156156 parser = ["items" ], creator = self .create_api_category_item )
157157
@@ -413,23 +413,23 @@ def add_item(language_id: int, url: str, content_type: str,
413413 description = "Profile van de npostart.nl website." )
414414
415415 add_item (LanguageHelper .Trending ,
416- "https://npo.nl/start/api/domain/recommendation-collection?key =trending-anonymous-v0" ,
416+ "https://npo.nl/start/api/domain/recommendation-collection?partyId=1&collectionId =trending-anonymous-v0" ,
417417 content_type = contenttype .TVSHOWS , parser = "collection-with-series" )
418418
419419 add_item (LanguageHelper .LatestNews ,
420420 f"https://npo.nl/start/_next/data/{ self .build_version } /collectie/nieuws-en-achtergronden.json?slug=nieuws-en-achtergronden" ,
421421 content_type = contenttype .TVSHOWS )
422422
423423 add_item (LanguageHelper .Popular ,
424- f"https://npo.nl/start/_next/data/{ self .__build_version } /collectie/nieuw-en-populair.json?slug=nieuw-en-populair" ,
424+ f"https://npo.nl/start/_next/data/{ self .build_version } /collectie/nieuw-en-populair.json?slug=nieuw-en-populair" ,
425425 content_type = contenttype .TVSHOWS )
426426
427427 # add_item(LanguageHelper.Categories,
428- # "https://npo.nl/start/api/domain/page-collection?guid =2670b702-d621-44be-b411-7aae3c3820eb",
428+ # "https://npo.nl/start/api/domain/page-collection?collectionId =2670b702-d621-44be-b411-7aae3c3820eb",
429429 # content_type=contenttype.TVSHOWS)
430430
431431 add_item (LanguageHelper .TvShows ,
432- "https://npo.nl/start/api/domain/page-layout?slug =programmas" ,
432+ "https://npo.nl/start/api/domain/page-layout?layoutId =programmas" ,
433433 content_type = contenttype .TVSHOWS )
434434
435435 live_radio = add_item (
@@ -524,10 +524,15 @@ def switch_profile(self, data: Union[str, JsonHelper]) -> Tuple[Union[str, JsonH
524524 "https://npo.nl/start/api/auth/session" ,
525525 json = profile_data , additional_headers = headers )
526526
527+ # https://npo.nl/start/api/domain/recommendation-layout?
528+ # layoutId=home&partyId=1%3Ambsf8b0g%3A15625624970147ebb696ae0a9768d49
529+ # profileGuid=0dba0d55-640e-4e70-9b00-1449816f13cf&
530+ # subscriptionType=free
527531 profile_content_url = (
528532 f"https://npo.nl/start/api/domain/recommendation-layout?"
529- f"page=home&"
530- #f"partyId=1%3Alp08hirt%3A2c8e90d7048a467babf108e0146ad52d&"
533+ f"partyId=1&"
534+ f"layoutId=home&"
535+ f"partyId=1&"
531536 f"profileGuid={ profile_id } &"
532537 # f"subscriptionType=free"
533538 )
@@ -542,10 +547,16 @@ def switch_profile(self, data: Union[str, JsonHelper]) -> Tuple[Union[str, JsonH
542547
543548 def create_profile_content_item (self , result_set : Dict [str , str ]) -> Union [MediaItem , List [MediaItem ], None ]:
544549 profile_id = self .parentItem .metaData ["id" ]
545- folder_key = result_set ["key" ]
550+
551+ if "key" in result_set :
552+ folder_key = result_set ["key" ]
553+ else :
554+ folder_key = result_set ["collectionId" ]
555+
546556 url = (
547557 f"https://npo.nl/start/api/domain/recommendation-collection?"
548- f"key={ folder_key } &"
558+ f"partyId=1&"
559+ f"collectionId={ folder_key } &"
549560 # f"partyId=1%3Alp08hirt%3A2c8e90d7048a467babf108e0146ad52d&"
550561 f"profileGuid={ profile_id } &"
551562 # f"subscriptionType=free"
@@ -625,7 +636,7 @@ def create_api_category_item(self, result_set: dict) -> Optional[MediaItem]:
625636 title = result_set ["title" ]
626637 slug = result_set ["slug" ]
627638
628- url = f"https://npo.nl/start/api/domain/page-layout ?slug={ slug } "
639+ url = f"https://npo.nl/start/_next/data/ { self . build_version } /collectie/ { slug } .json ?slug={ slug } "
629640 item = FolderItem (title , url , content_type = contenttype .TVSHOWS )
630641
631642 if "images" in result_set and result_set ["images" ]:
@@ -635,13 +646,18 @@ def create_api_category_item(self, result_set: dict) -> Optional[MediaItem]:
635646 return item
636647
637648 def create_api_page_layout (self , result_set : dict ) -> Optional [MediaItem ]:
638- guid = result_set ["guid" ]
649+ if "guid" in result_set :
650+ guid = result_set ["guid" ]
651+ else :
652+ guid = result_set ["collectionId" ]
639653 page_type = result_set ["type" ]
640- url = f"https://npo.nl/start/api/domain/page-collection?type={ page_type .lower ()} &guid ={ guid } "
654+ url = f"https://npo.nl/start/api/domain/page-collection?type={ page_type .lower ()} &collectionId ={ guid } &partyId=1 "
641655
642656 info = UriHandler .open (url )
643657 info = JsonHelper (info )
644658 title = info .get_value ("title" )
659+ if not title or title .strip () == "" and "layoutId=programmas" in self .parentItem .url :
660+ title = LanguageHelper .get_localized_string (LanguageHelper .Categories )
645661
646662 if page_type == "SERIES" :
647663 content_type = contenttype .TVSHOWS
@@ -948,8 +964,8 @@ def search_site(self, url: Optional[str] = None, needle: Optional[str] = None) -
948964 if not needle :
949965 raise ValueError ("No needle present" )
950966
951- shows_url = "https://npo.nl/start/api/domain/search-results ?searchType=series&searchQuery=%s&subscriptionType=anonymous"
952- videos_url = "https://npo.nl/start/api/domain/search-results ?searchType=broadcasts&searchQuery=%s&subscriptionType=anonymous"
967+ shows_url = "https://npo.nl/start/api/domain/search-collection-items ?searchType=series&partyId=1 &searchQuery=%s&subscriptionType=anonymous"
968+ videos_url = "https://npo.nl/start/api/domain/search-collection-items ?searchType=broadcasts&partyId=1 &searchQuery=%s&subscriptionType=anonymous"
953969
954970 items = []
955971 needle = HtmlEntityHelper .url_encode (needle )
0 commit comments