Git Product home page Git Product logo

freshlive_tv_helper's Introduction

freshlive.tv Helper

The repository contains a collection of tools for downloading archived programs of subscribed channels on Fresh!.

Fresh! is a Japanese live streaming platform which delivers programs in HTTP Live Streaming. It protects paid contents by HLS encryption with keys (EXT-X-KEY) that are further encrypted with user tokens in a custom algorithm.

It also comes with a simple run.sh for downloading a program, and could possibly explain the usage contexts for the above tools. (The script could be outdated if the site get updated in the future.)

Prerequisites

  • shell commands (sh, sed, grep)
  • ruby
  • node
  • ffmpeg (if need downloading)

tested on macOS High Sierra.

Installing

Checkout the codes first,

git clone https://github.com/Adios/freshlive_tv_helper

And then setup the modules for node,

npm install

Finally the gems with Bundler,

bundle --standalone

Usage

Before starting, you should obtain two URLs from the program page,

  • Log into Fresh!
  • Browse to an archieved paid program you want to download, e.g.: https://freshlive.tv/uchidamaaya/191012. (Note that you must be a subscriber for that channel in order to get the required information.)
  • Open developer tool, find the link to the archive.m3u8 with a token included, it looks like this:
    https://movie.freshlive.tv/manifest/191012/archive.m3u8?token=NNNNNNtNNNNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&version=2&beta4k=
    
  • app.js, at which the site stores the custom secret, e.g.:
    https://freshlive.tv/assets/1524096831/app.js
    

Step By Step

Let us first get the encrypted encryption key of that program from the archive.m3u8 ,

bin/retrieve_encryption_key_uri.rb \
        'https://movie.freshlive.tv/manifest/191012/archive.m3u8?token=NNNNNNtNNNNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&version=2&beta4k='

You would see the result string like this,

abemafresh://abemafresh/NNNNNNtNNNNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/0de7c2f47df5b6a559fbdeff5341363a

Acutually it's the URI value of the m3u8's EXT-X-KEY field. However ffmpeg is unable to recognize the meaning since it is further encrypted with Fresh!'s algorithm. That's why you can't ffmpeg -i m3u8 -c copy without pain.

Now let us decrypt the string with the secret stored at app.js

bin/decrypt_key_with_appjs.js \
        'abemafresh://abemafresh/NNNNNNtNNNNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/0de7c2f47df5b6a559fbdeff5341363a' \
        'https://freshlive.tv/assets/1524096831/app.js' > program.key

Congratulations! You obtain the real encryption key program.key which should be a 16-bytes binary file. And we then make a new playlist from archive.m3u8 with the real encryption key:

bin/customize_playlist.rb \
        'https://movie.freshlive.tv/manifest/191012/archive.m3u8?token=NNNNNNtNNNNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&version=2&beta4k=' \
        program.key > program.m3u8

And finally download it with ffmpeg:

ffmpeg -allowed_extensions ALL \
        -protocol_whitelist 'crypto+https,file,crypto,https,tls,tcp' \
        -i program.m3u8 -codec copy program.ts

All-For-One

Could also see https://adios.github.io/freshlive_tv_helper/how-to-download-programs.

  1. Log in, browser to program page, e.g.: https://freshlive.tv/uchidamaaya/191012.
  2. Open developer tool, look for ?token=NNNNNNtNNNNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX to get your token.
  3. run.sh it.
    ./run.sh 'NNNNNNtNNNNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' 'https://freshlive.tv/uchidamaaya/191012'

Authors

  • Adios - Initial work - Adios

freshlive_tv_helper's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

freshlive_tv_helper's Issues

Guide

Hi,

I'm sort of new at compiling, and I'm running into issues getting this to work. The run.sh script doesn't seem to be working and so I am going through the instructions, but am getting errors.

Can you possibly make a video showing how to download videos using this method?

Thanks

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.