Client#
nrk-psapi.
- class nrk_psapi.api.NrkPodcastAPI[source]#
Bases:
objectNrkPodcastAPI(auth_client: ‘NrkAuthClient’ = <factory>, disable_credentials_storage: ‘bool’ = False, user_agent: ‘str | None’ = None, enable_cache: ‘bool’ = True, cache_directory: ‘str | None’ = None, request_timeout: ‘int’ = 15, session: ‘ClientSession | None’ = None, _close_session: ‘bool’ = False)
-
auth_client:
NrkAuthClient# The authentication client.
- Type:
auth_client (NrkAuthClient)
-
cache_directory:
str|None= None# Cache directory, defaults to (in order):
Value of environment variable NRK_PSAPI_CACHE_DIR
~/.cache/nrk-psapi
- async save_credentials(filename=None)[source]#
Save the current authentication credentials to a file.
- Parameters:
filename (PathLike | None) – The file to save the credentials to. If None, uses the default location.
- Return type:
- async load_credentials(filename=None)[source]#
Load authentication credentials from a file.
- Parameters:
filename (PathLike | None) – The file to load the credentials from. If None, uses the default location.
- Return type:
- async send_message(podcast_id, message, *, anonymous=False, phone=None)[source]#
Send a message to a podcast.
- async get_playback_manifest(item_id, *, podcast=False, program=False, channel=False)[source]#
Get the manifest for an episode/program/channel.
- Parameters:
- Return type:
- async get_playback_metadata(item_id, *, podcast=False, program=False, channel=False)[source]#
Get the metadata for an episode/program/channel.
- Parameters:
- Return type:
- async get_series_type(series_id)[source]#
Get series type.
- Parameters:
series_id (str) – Series ID.
- Return type:
- async get_podcast_type(podcast_id)[source]#
Get podcast type.
- Parameters:
podcast_id (str) – Podcast ID.
- Return type:
- async get_series_episodes(series_id, season_id=None, *, page_size=None, page=1)[source]#
Get series episodes.
- async get_podcast(podcast_id)[source]#
Get podcast.
- Parameters:
podcast_id (str) – Podcast ID.
- Return type:
Podcast|PodcastStandard|PodcastUmbrella|PodcastSequential
- async get_podcast_episodes(podcast_id, season_id=None, *, page_size=None, page=None)[source]#
Get podcast episodes.
- async get_recommendations(item_id, context_id=None, limit=None)[source]#
Get recommendations.
- Parameters:
item_id (str) – A id of a series/program/episode/season etc.
context_id (RecommendationContext, optional) – Which context (front page, series page, etc.) the user is in.
limit (int, optional) – Number of recommendations returned (max 25). Defaults to 12.
- Return type:
- async count_new_favourited_episodes(favourite_level=None, since=None)[source]#
Count new episodes.
- Parameters:
favourite_level (FavouriteLevel | None)
since (datetime | None)
- async get_user_favorites(manual_only=False, sort_order=SortOrder.DESCENDING, key=None, page_size=None)[source]#
Get user favorites.
- async add_user_favourite(item_type, item_id)[source]#
Add user favourite.
- Parameters:
item_type (FavouriteType)
item_id (str)
- async browse(letter=None, category=None, per_page=50, page=1)[source]#
Browse all series, podcast and umbrella seasons, optionally filtered by category.
Alphabetical listing of all series, podcasts and umbrella seasons that are not excluded from search results in given category. Categories correspond to those in from
radio_pages(). For the category ‘podcast’, all podcasts are listed, also those excluded from search results.- Parameters:
- Return type:
- async search(query, per_page=50, page=1, search_type=None)[source]#
Search anything.
- Parameters:
query (str) – Search query.
per_page (int, optional) – Number of items per page. Defaults to 50.
page (int, optional) – Page number. Defaults to 1.
search_type (SearchResultType, optional) – Search type, one of
SearchResultType. Defaults to all.
- Return type:
- async curated_podcasts()[source]#
Get curated podcasts. This is a wrapper around
radio_page(), with the section_id set to “podcast” and some logic to make it easier to use for accessing curated podcasts.- Return type:
- async fetch_file_info(url)[source]#
Proxies call to
utils.fetch_file_info(), passing onsession.- Return type:
- Parameters:
- async generate_tiled_images(image_urls, tile_size=100, columns=3, aspect_ratio=None)[source]#
Proxies call to
utils.tiled_images(), passing onsession.
-
auth_client: