用于nrk的api还包括一个cli工具,用于从nrk下载系列或程序。
nrk-api的Python项目详细描述
NRK的API。(Norsk Rikskringkasting)(最初打算支持 cli)
cli用法
此外,您还需要`ffmpeg<;https://ffmpeg.org/>;`,例如。 apt-get install ffmpeg(ubuntu),brew install ffmpeg(macos)
usage: nrkdl [-h] [-s keyword] [-d] [-b] [-sub] [-dr] [-sp SAVE_PATH] [-u URL] [-ea EXPIRES_AT] CLI tool to download video from NRK. optional arguments: -h, --help show this help message and exit -s keyword, --search keyword Search nrk for a show and download files -d, --description Print verbose program description in console -b, --browse Builds a menu where you can choose popular categories -sub, --subtitle Download subtitle for this program too. -dr, --dry_run Dry run, dont download any files. -sp SAVE_PATH, --save_path SAVE_PATH Set a save path -u URL, --url URL Use NRK URL as source. Comma separated e.g. "url1, url2" -ea EXPIRES_AT, --expires_at EXPIRES_AT Get all files that looses access rights between two dates or a date
搜索
> nrkdl -s "brannma" 2: Brannmann i seks knop 1: Brannmann 0: Brannmann Sam Select a number or use slice notation 0 ..... ..... 4: Brannmann Sam S03E29 3: Brannmann Sam S03E30 2: Brannmann Sam S03E32 1: Brannmann Sam S03E33 0: Brannmann Sam S05E25 Select a number or use slice notation :: Downloads starting soon.. 23 downloads to go 100%|############################################################################| 23/23 [03:57<00:00, 79.09s/it]
网址
> nrkdl -u "http://tv.nrksuper.no/serie/bernt-og-erling-paa-nye-eventyr http://tv.nrksuper.no/serie/bertine-paa-besoek" 100%|####################################################################################| 2/2 [00:21<00:00, 13.63s/it]
模块
nrk = NRK() s = await nrk.search("lille jack", strict=True)[0] for e in await s.episodes(): await e.download() all_downloads = nrk.downloads() # How many files are we gonna download print(len(nrk.downloads())) # Start downloading await all_downloads.start()
有关更多示例,请参见示例和源文件
使用Docker
要在自包含的docker容器中使用nrkdl,提供 Dockerfile应该可以让您进行一次最简单的安装。如果你 想把它合并成一个独立的命令,如下所示 做你想做的。
#!/bin/sh # export DATA="/mnt/multimedia/tmp" # Set if you don't want downloads to go to your ${HOME}/downloads cd${HOME}/Projects/programming/nrkdl # Path where we can find a checkout of this repository docker run -it -v ${DATA:-${HOME}/downloads}:/nrkdl/downloads $(docker build -q .)$*# Open data-path if we are on osx # [[ $? == 0 ]] && ( open ${DATA} )
现在可以使用示例nrkdl -s "brannma"运行它。
安装
pip安装nrk_api
你为什么要用这个图书馆?
- 易于下载整个节目
- 浏览功能
- 修正了电视节目糟糕的命名,这样就可以通过 KODI/PLEX/EMBY
- 很快,我的500兆比特连接就到了极限。