I dont like to watch on-line movies on bad internet connection because of lags. So I found a good on-line cinema, check hot video player works there and create a simple script to download full movie.
The size comparsion to regular DVD-quality on torrents is 1.5Gb to 500Mb. Sounds good!

The algorythm of service is to load an iframe. Player located in iframe, works with m3u file, where links to different video qualities playlistst located. The final playlist consist of video segments list.
On the first step I was downloading segments with wget, making a simple bash loop. But later I've figure out that ffmpeg can do it on it own! Simplier than ever.
Ok, so we should get the playlist from website with the help of bash.

First of all we should get the URL from IFRAME. This can be achieved with hxnormalize, hxselect and hxwls programs from package html-xml-utils

$ sudo apt install html-xml-utils

The div with iframe looks like this:

<div class="video-player-wrapper">
    <iframe id="video-player" width="720" height="400" src="https://somewhere.web/1234" frameborder="0" allowfullscreen></iframe>
</div>

create a function to get this url:

get_iframe_video_url() {
    echo $1 |
    wget -O- -i- --no-verbose | 
    hxnormalize -x | 
    hxselect -i "div.video-player-wrapper iframe" |
    hxwls
}

Then we should get the URI where playlist and movie segments located. It's the js scipt.

get_video_uri() {
    echo $1 |
    wget -O- -i- --no-verbose | 
    grep -E -o 'file:"(.*)m3u8' | 
    sed -n 's/file:"//p' |
    sed -n 's/index.m3u8//p'
}

and the last one is to concat all segments with ffmpeg:

PLAYLIST="$VIDEO_URI/$QUALITY/index.m3u8"
ffmpeg -i $PLAYLIST -c copy -bsf:a aac_adtstoasc "$DIRECTORY.mp4" -y

Name of the final file is the last part of URL without extension.
For example: 
https://somewhere-onilne.web/movie/best-movie.html becomes best-movie.

get_directory_from_url() {
    echo $1 | sed 's#.*/##'
}
DIRECTORY=$(get_directory_from_url $URL);
DIRECTORY="${DIRECTORY%.*}"

And here is the first function which creates to lists with files to download and concatanate with wget and ffmpeg:

create_segments_file() {
    if test -f "$FILE_FFMPEG_LIST"; then
       rm $FILE_FFMPEG_LIST
    fi
    if test -f "$FILE_FFMPEG_LIST"; then
       rm $FILE_WGET_LIST
    fi
    # download movie playlist
    wget $VIDEO_URI/$QUALITY/index.m3u8 --output-document=pls.file --no-verbose
    LIST=$(grep segment pls.file)
    rm pls.file
    for f in $LIST;
    do
        echo "file '$DIRECTORY/$f'" >> $FILE_FFMPEG_LIST
        echo "$VIDEO_URI$QUALITY/$f" >> $FILE_WGET_LIST
    done
    echo "Saving files done."
}

Here's gist: https://gist.github.com/onesixromcom/649a2b7ff95a78a5125b3994fbaec7aa

Add new comment

The content of this field is kept private and will not be shown publicly.
  • No HTML tags allowed.
   .oooooo.      .oooooo.                    .ooo       oooo  ooooooo  ooooo 
d8P' `Y8b d8P' `Y8b .88' `888 `8888 d8'
888 888 .ooooo. d88' 888 Y888..8P
888 888 d88' `88b d888P"Ybo. 888 `8888'
888 888 ooooo 888ooo888 Y88[ ]88 888 .8PY888.
`88b ooo `88. .88' 888 .o `Y88 88P 888 d8' `888b
`Y8bood8P' `Y8bood8P' `Y8bod8P' `88bod8' .o. 88P o888o o88888o
`Y888P

Enter the code depicted in ASCII art style.