In [ ]:
%load_ext autoreload
%autoreload 2

In [12]:
import nrkdownload

series = nrkdownload.nrktv.series_from_series_id('dagsnytt')
program = series.seasons[-1].episodes[-2]
program.get_download_details()
program.make_filename()
nrkdownload.nrktv.download_programs([program])


Ready to download 1 programs, with total duration 0:05:00
Downloading: 100%|██████████| 300/300 [00:03<00:00, 288s/s]  

In [11]:
dir(program)


Out[11]:
['__class__',
 '__delattr__',
 '__dict__',
 '__dir__',
 '__doc__',
 '__eq__',
 '__format__',
 '__ge__',
 '__getattribute__',
 '__gt__',
 '__hash__',
 '__init__',
 '__le__',
 '__lt__',
 '__module__',
 '__ne__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__setattr__',
 '__sizeof__',
 '__slotnames__',
 '__str__',
 '__subclasshook__',
 '__weakref__',
 'description',
 'duration',
 'episode_number_or_date',
 'episode_title',
 'filename',
 'get_download_details',
 'image_url',
 'make_filename',
 'media_urls',
 'program_id',
 'series_id',
 'subtitle_urls',
 'title']

In [ ]:
import nrkdownload
import logging
nrkdownload.nrktv.LOG.setLevel(logging.INFO)

In [ ]:


In [ ]:
s = nrkdownload.nrktv.series_from_series_id('dagsnytt')

In [ ]:
p = s.seasons[-1].episodes[-2]
p.get_download_details()

In [ ]:
nrkdownload.nrktv.download_programs_in_parallel([p])

Search for a series


In [ ]:


In [ ]:
string = 'vestlandsrevyen'
search_type = 'series'
result = nrkdownload.nrktv.search(string, search_type)
result

In [ ]:
nrkdownload.nrktv.LOG.setLevel(logging.WARNING)
for r in result:
    print(r)
    r.get_seasons_and_episodes()
    for s in r.seasons:
        print(' '*4, s, s.number)
#         for e in s.episodes:
#             print(' '*8, e)

Search for a program


In [ ]:
string = 'skam'
search_type = 'program'
result = nrkdownload.nrktv.search(string, search_type)
result

In [ ]:
r = nrkdownload.nrktv.search('Herdlefjorden', 'program')
r

In [ ]:
r[0].get_download_details()

In [ ]:
r[0].media_urls

In [ ]:
r[0].make_filename()

In [ ]:
s = nrkdownload.nrktv.series_from_series_id('tidenes-sommer')

In [ ]:
s.get_seasons_and_episodes()

In [ ]:
for se in s.seasons:
    print(se)
    for e in se.episodes:
        print(e)

In [ ]:
p = s.seasons[-1].episodes[-2]
print(p)

In [ ]:
p.program_id

In [ ]:
p.program_id

In [ ]:
import requests
NRK_PS_API = 'http://v8.psapi.nrk.no'
SESSION = requests.Session()
SESSION.headers['app-version-android'] = '999'

program_id = 'MUHH48000516'
r = SESSION.get(NRK_PS_API + '/mediaelement/' + program_id)
r.raise_for_status()
json = r.json()
json['programId'] = program_id
json['imageId'] = json['image']['id']

program = nrkdownload.nrktv.new_program_from_search_result(json)
program.get_download_details(json=json)

In [ ]:
program.series_id

In [ ]:
s = nrkdownload.nrktv.series_from_series_id('paa-date')
dir(s)

In [ ]:
nrkdownload.config.KNOWN_SERIES

In [ ]:
s = nrkdownload.nrktv.series_from_series_id('sjakk')

In [ ]:
d = {1: 'sdaf', 2: 'fdg'}

In [ ]:
if 1 in d:
    print("Yes")

In [ ]:
p.get_download_details()
p.media_urls

In [ ]:
[s for s in dir(p) if not s.startswith('__')]

In [ ]:
p.get_download_details()

In [ ]:
p.subtitle_urls

In [ ]:
result[0].episode_number_or_date

In [ ]:
result[0].seasons[0].episodes[1].programId

In [ ]:
nrkdownload.config.KNOWN_SERIES['skam'].get_seasons_and_episodes()

In [ ]: