GuillaumeSmaha / youtube-webos-cobalt-browser

GNU General Public License v3.0
8 stars 3 forks source link

youtube-webos-cobalt-browser

YouTube App built with Cobalt with extended functionalities.

This project is built on top of youtube-webos.

Cobalt only support a subset of HTML tags, youtube-webos had to be reworked to only use div tag.

This project doesn't work with all LG TV. It is required that the Offical Youtube Application for your TV is using Cobalt with the library libcobalt.so

This application uses https://github.com/GuillaumeSmaha/youtube-webos-cobalt-app to provide the *.css and *.js files to inject into Cobalt.

Configuration Screen Segment Skipped Speed Configuration

Features

Same as the default youtube application:

Same as youtube-webos:

Note: Configuration screen can be opened by pressing 🟩 GREEN button on the remote.

Pre-requisites

Installation

Before installing, you need to patch your Youtube Application: See Patching your IPK

Then install it using one of the following:

Configuration

Configuration screen can be opened by pressing 🟩 GREEN button on the remote.

On a computer browser, char key = can be used on open it.

Autostart

In order to autostart an application the following command needs to be executed via SSH or Telnet:

luna-send-pub -n 1 'luna://com.webos.service.eim/addDevice' '{"appId":"youtube.leanback.v4","pigImage":"","mvpdIcon":""}'

This will make "YouTube AdFree" display as an eligible input application (next to HDMI/Live TV, etc...), and, if it was the last selected input, it will be automatically launched when turning on the TV.

This will also greatly increase startup performance, since it will be runnning constantly in the background, at the cost of increased idle memory usage. (so far, relatively unnoticable in normal usage)

In order to disable autostart run this:

luna-send -n 1 'luna://com.webos.service.eim/deleteDevice' '{"appId":"youtube.leanback.v4"}'

Patching your IPK

Patching the Youtube IPK for your TV requires that the IPK was built as 2 binaries: cobalt and libcobalt.so.

cobalt is handling the grahical part with the TV and libcobalt.so is handling the browser rendering and javascript engine.

Cobalt is an open-source and it is possible to rebuild libcobalt.so and therefore inject adblock.css and adblock.js after the loading the Youtube webpage.

Cobalt Patch Process

Instruction to patch your IPK

Follow instructions on https://docs.docker.com/engine/install/

Make sure to install all docker components like docker-buildx-plugin and docker-compose-plugin.

sudo apt install jq git patch sed binutils squashfs-tools rename findutils xz-utils
git clone https://github.com/GuillaumeSmaha/youtube-webos-cobalt-browser.git

git submodule update --init

make PACKAGE=./your-tv-youtube.ipk


Customize package name:
`PACKAGE_NAME` can be defined to change the package name
```sh
make PACKAGE=./your-tv-youtube.ipk PACKAGE_NAME=youtube-free.leanback.v4

Build Cobalt

If you need to update Cobalt patches or if you don't trusted pre-compiled version stored in cobalt-bin, you can build them yourself.

The building process is:

This process is handled by the following commands:

For example: for Cobalt 23.lts.4 and SB Api version 12:

git clone https://github.com/GuillaumeSmaha/youtube-webos-cobalt-browser.git

cd youtube-webos-cobalt-browser

make cobalt-bin/23.lts.4-12/libcobalt.so cobalt-bin/23.lts.4-12.xz

Then, you can call make PACKAGE=./your-tv-youtube.ipk to rebuild an IPK with your updated version of Cobalt

Building issue

If you already built cobalt for a different version and got an error like node-gyp not found:

Try to clean docker image used to build and retry.

docker image rm cobalt-build-evergreen cobalt-build-linux cobalt-build-base cobalt-base

Try to clean old Cobalt builds and retry:

rm -fr cobalt/out/
make cobalt-clean

Build Youtube-Webos

See directly on repository https://github.com/GuillaumeSmaha/youtube-webos-cobalt-app.git or README.md in youtube-webos directory.

Development TV setup

Configuring webOS TV CLI tools with Developer Mode App

This is partially based on: https://webostv.developer.lge.com/develop/app-test/using-devmode-app/

ares-setup-device -a webos -i "username=prisoner" -i "privatekey=/path/to/downloaded/webos_rsa" -i "passphrase=PASSPHRASE" -i "host=TV_IP" -i "port=9922"

Configuring webOS TV CLI tools with Homebrew Channel / root

ares-setup-device -a webos -i "username=root" -i "privatekey=/path/to/id_rsa" -i "passphrase=SSH_KEY_PASSPHRASE" -i "host=TV_IP" -i "port=22"