Coder Social home page Coder Social logo

nrk-tv-downloader's Introduction

nrk-tv-downloader

Lightweight bash utility to easily download content from nrk-tv, radio and super.

Terminal with nrk-tv-downloader

About

This is just another simple shell-script that downloads programs from nrk-tv. It also supports nrk-radio and nrk-super.

This script has nothing to do with NRK!

Install

git clone https://github.com/odinuge/nrk-tv-downloader --recursive

Subtitles

To download subtitles you need tt-to-subrip. To get it, you have to clone this repo with the --recursive flag, or execute the following (inside this repo):

git submodule update --init --recursive

Usage

$ ./nrk-tv-downloader.sh

Usage: ./nrk-tv-downloader.sh <OPTION>... [PROGRAM_URL(s)]...

Options:
     -a download all episodes, in all seasons.
     -s download all episodes in season
     -n skip files that exists
     -d dry run - list what is possible to download
     -u do not download subtitles
     -e episode mode - format episodes as Series.name.SXXEXX.mp4
     -f create series and season number folders for episodes (use together with -e)
     -q will ask you to select quality
     -t target directory for downloaded files (e.g. /mnt/media/TV - no trailing slash)
     -h print this


For updates see <https://github.com/odinuge/nrk-tv-downloader>

Example:
$ ./nrk-tv-downloader.sh -s "url"

Code style

The source code (nrk-tv-downloader.sh) is formatted with shfmt. To format the code, run:

$ shfmt -l -w nrk-tv-downloader.sh

Requirements

This script requires bash, rev, cut, grep, sed, gawk, printf, curl, ffmpeg/avconv and jq.

License

MIT © Odin Ugedal

nrk-tv-downloader's People

Contributors

asbjorn avatar eightyplus avatar eithe avatar lilleengen avatar mmathys avatar odinuge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nrk-tv-downloader's Issues

Local filename format

This is a future request for the downloader to name programs that are based on seasons and episodes in a format that allows content scanners to read out the season and episode numbers from the filenames. My personal preference is Name.Of.Show.SXXEXX.mp4 (e.g. Arkitektens.hjem.S01E04.mp4), but perhaps it can be customizable by the user.

I have a hacked together version (I'm no bash scripter) of this running locally using the format above. I'll see if I can make it release friendly and submit a PR later, just wanted to get the idea out there and perhaps get some input.

- Tv program is not available: stremerror.

I get this error on all programs, " - Tv program is not available: stremerror "

Solution:
Open the browser and start playing the episode.
Then start the script to download the episode.

Change output filename format

Hi

Could there be an option (or change the current default) to use a more media server friendly name?

Should be Series Name S[xx]E[xx]-[Optional episode name]

"stremerror" ved nedlasting

Hei!

Jeg får ikke skriptet til å funke nå om dagen. Får en kryptisk feilmelding, f.eks.:

kjetil@tigger:/mnt/store-c/serier/Kaptein_Sabeltann-Kongen_på_havet$ nrk-tv-downloader.sh  -a -u -e https://tv.nrk.no/serie/kaptein-sabeltann
Available seasons of "kaptein-sabeltann": 1
Available episodes in "Kaptein Sabeltann, sesong: 1": 11
Program "Kaptein Sabeltann - Kongen på havet 22:26"
 - Tv program is not available: stremerror

Program "Kaptein Sabeltann - Kongen på havet 21:26"
 - Tv program is not available: stremerror

og

kjetil@tigger:/mnt/store-c/serier/Karsten_og_Petra$ nrk-tv-downloader.sh -a -u -e https://tv.nrk.no/serie/karsten-og-petra
Available seasons of "karsten-og-petra": 6
Available episodes in "Karsten og Petra, sesong: 6": 10
Program "Karsten og Petra 10:10"
 - Tv program is not available: stremerror

Program "Karsten og Petra 9:10"
 - Tv program is not available: stremerror

osv.

Noen ideer om hva som kan være galt her?

Program cannot be downloaded

I have tried a program: https://tv.nrksuper.no/program/MSUI14009011/plass-bakpaa-kosten, which is still available and can be played at the website, but get this error:

parse error: Invalid numeric literal at line 1, column 4
parse error: Invalid numeric literal at line 1, column 4
Available episodes in "": 0

The program is not available through https://tv.nrk.no/program/MSUI14009011/plass-bakpaa-kosten wither:

parse error: Invalid numeric literal at line 1, column 10
parse error: Invalid numeric literal at line 1, column 10
Program ""

  • Tv program is not available:

Tried with the dryrun only too.

Tv program is not available

Hi, using the latest version on Mac OS X (with gawk, ffmpeg and other dependencies installed), I get:

TV:nrk tv$ ./nrk-dl.sh https://tv.nrk.no/serie/thomas-og-vennene-hans/MSUI21004115/sesong-1/episode-1
Downloading ""
./nrk-dl.sh: line 393: [: ==: unary operator expected
 - Tv program is \e[31mnot available\e[0m:

Guessing it's a bit difficult for you to debug on mac, but got an idea on where I should start looking?

URLs have changed; cannot download episodes when rights expired

It seems like URLs have changed, and I wonder if that causes some problems.

This is the problem I'm struggling with:

$ nrk-tv-downloader.sh -n -d -u https://tv.nrk.no/serie/kaptein-sabeltann/sesong/1/episode/19/
Program "Kaptein Sabeltann - Kongen på havet 1:26"
 - Tv program is not available:  program rights has expired

There may be several problems, one is that the URL seemingly has changed. One is that it first tries to download episode 1, when it was supposed to get episode 19. The last is that it gives up because the rights for episode 1 has expired. I don't know which is actually the root cause here.

Unable to download - find no seasons or program not available - Ubuntu

Trying to download get these errors - used to work - on ubuntu server - be awesome if it has a solution:

root@peep:/home/fnx/nrk-tv-downloader# ./nrk-tv-downloader.sh -a https://tv.nrk.no/serie/stjernestoev/
Unable to download. Found no seasons.
root@peep:/home/fnx/nrk-tv-downloader# ./nrk-tv-downloader.sh https://tv.nrk.no/serie/stjernestoev/sesong/1/episode/23/
parse error: Invalid numeric literal at line 1, column 10
parse error: Invalid numeric literal at line 1, column 10
Program ""

  • Tv program is not available:

Not dowloading - remove Readonly

To get your script to work, I had to remove the "readonly" on two lines :

# Check for ffmpeg or avconv
for downloader in $DOWNLOADERS; do
    if hash "$downloader" 2>/dev/null; then
#        readonly DOWNLOADER_BIN=$downloader
        DOWNLOADER_BIN=$downloader    # Had to remove the readonly
    fi
done

if [ -z "$DOWNLOADER_BIN" ]; then
    echo "This program needs one of these tools: $DOWNLOADERS"
    exit 1
fi

PROBE_BIN=""
readonly PROBES="ffprobe avprobe"
for probe in $PROBES; do
    if hash "$probe" 2>/dev/null; then
#        readonly PROBE_BIN=$probe
        PROBE_BIN=$probe    # Had to remove the readonly
    fi

done

Feature suggestion; include subtitles inside video file (basic source code example provided)

Attached changes allow the subtitle to be embedded as a stream into the video file. These can be selected on or off when viewing the video. This works for Quicktime on a Mac for example. Quicktime does not support standalone SRT files.

The below example is simplistic and forces the metadata to set language=nor (general Norwegian). Ideally it would identify the subtitle language somehow and set language to Bokmål, Nynorsk, English or other specific language as appropriate. Language codes should be ISO 639-2 Language Codes.

The key changes are:
...
download "$stream" "$dl_file" "$subtitle_file"
...
local subtitle_file=$3
...
if [ -f "$subtitle_file" ]; then
downloader_params="-i $subtitle_file $downloader_params -scodec mov_text -metadata:s:s:0 language=nor"
fi
...

nrk-tv-downloader.sh.txt

fix_filename missing

Hi, where should the fix_filename function come from? Getting:

 ./nrk-dl.sh: line 324: fix_filename: command not found

It works without it, just wondering .. :) Thanks for creating it!

NRK Terms of Use

I'm hoping to download some videos from NRK, however...

Does this breach their terms of use? I could not find any information on it, so I wanted to make sure that using this tool is 100% allowed.

Thanks!

Ignore if local file is present

Would it be possible to add a switch that ignores local files if they are present?
Usefull for re-running the script when new shows in a series is available.

Metadata

Add metadata to the video file when downloading with ffmpeg/avconv.

Example here

the -a -n switch is not working anymore

Trying to download a complete series from super, stopped working.
Single episodes downloading from nrk super, but does not seem to work from tv.nrk.no...
Seems like they detect the script, says "Vi beklager"

example:
working:
http://tv.nrksuper.no/serie/mamma-moe-og-kraaka/OBUI59005305/sesong-1/episode-3

not working (worked before):
output:
./nrk-tv-downloader.sh -a -n https://tv.nrk.no/serie/peppa-gris/MSUI44005109/sesong-1/episode-52
Downloading "Vi beklager"
Downloading "Vi beklager"
Downloading "Vi beklager"

ETA

Print ETA and download speed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.