Skip to content

Commit

Permalink
Changed: Make login optional (See #1842).
Browse files Browse the repository at this point in the history
  • Loading branch information
basrieter committed Dec 20, 2024
1 parent 6bfcde6 commit fcc01d4
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions channels/channel.nos/nos2010/chn_nos2010.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self, channel_info: ChannelInfo):

self._add_data_parser("https://npo.nl/start/api/domain/guide-channels",
name="Main Live TV Streams json", json=True,
requires_logon=True,
requires_logon=bool(self.__user_name),
parser=[],
creator=self.create_api_live_tv,
updater=self.update_video_item_live)
Expand All @@ -81,21 +81,23 @@ def __init__(self, channel_info: ChannelInfo):

self._add_data_parser("https://npo.nl/start/live?channel=",
name="Live Video Updater from json",
requires_logon=True,
requires_logon=bool(self.__user_name),
updater=self.update_video_item_live)

# If the user was logged in, we need to refresh the token otherwise it will result in 403
self._add_data_parsers([
"https://npo.nl/start/api/domain/page-collection?guid=",
"https://npo.nl/start/api/domain/page-collection?type=series&guid=",
"https://npo.nl/start/api/domain/search-results?searchType=series"],
name="Collections with series", json=True, requires_logon=bool(self.__user_name),
name="Collections with series", json=True,
requires_logon=bool(self.__user_name),
parser=["items"],
creator=self.create_api_program_item)
# Use the new `label` options for the collections
self._add_data_parser(
"https://npo.nl/start/api/domain/recommendation-collection?key=", name="Collection with series",
json=True, label="collection-with-series", requires_logon=bool(self.__user_name),
json=True, label="collection-with-series",
requires_logon=bool(self.__user_name),
parser=["items"],
creator=self.create_api_program_item)

Expand All @@ -104,14 +106,16 @@ def __init__(self, channel_info: ChannelInfo):
"https://npo.nl/start/api/domain/search-results?searchType=broadcasts",
"https://npo.nl/start/api/domain/page-collection?type=program&guid="
],
name="Collections with videos", json=True, requires_logon=bool(self.__user_name),
name="Collections with videos", json=True,
requires_logon=bool(self.__user_name),
parser=["items"],
creator=self.create_api_episode_item_with_data
)
# Use the new `label` options for the collections
self._add_data_parser(
"https://npo.nl/start/api/domain/recommendation-collection?key=", name="Collection with videos",
json=True, label="collection-with-videos", requires_logon=bool(self.__user_name),
json=True, label="collection-with-videos",
requires_logon=bool(self.__user_name),
parser=["items"],
creator=self.create_api_episode_item_with_data)

Expand Down Expand Up @@ -139,7 +143,8 @@ def __init__(self, channel_info: ChannelInfo):
updater=self.update_single_video)

# Standard updater
self._add_data_parser("*", requires_logon=True,
self._add_data_parser("*",
requires_logon=bool(self.__user_name),
updater=self.update_video_item)

self._add_data_parser("https://npo.nl/start/api/domain/page-layout?slug=",
Expand All @@ -148,7 +153,8 @@ def __init__(self, channel_info: ChannelInfo):

# Favourites (not yet implemented in the site).
self._add_data_parser("https://npo.nl/start/api/domain/user-profiles",
match_type=ParserData.MatchExact, json=True, requires_logon=True,
match_type=ParserData.MatchExact, json=True,
requires_logon=True,
name="Profile selection",
parser=[], creator=self.create_profile_item)

Expand Down

0 comments on commit fcc01d4

Please sign in to comment.