Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 147 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,126 +1,207 @@
# youtube-webos
<h1 align="center">
YouTube Ad-Free
</h1>
<p align="center">
<img src="https://img.shields.io/github/stars/webosbrew/youtube-webos?style=flat-square&logo=github" alt="GitHub Stars">
<img src="https://img.shields.io/github/v/release/webosbrew/youtube-webos?style=flat-square" alt="Latest Release">
<img src="https://img.shields.io/github/contributors/webosbrew/youtube-webos?style=flat-square" alt="Contributors">
<img src="https://img.shields.io/github/downloads/webosbrew/youtube-webos/total?style=flat-square" alt="Total Downloads">
<img src="https://img.shields.io/badge/LG-webOS-000000?logo=webos&logoColor=white&style=flat-square" alt="webOS">
</p>

<p align="center">
YouTube app for webOS TV with ad blocking and other enhancements
</p>

![Configuration Screen](./screenshots/1_sm.jpg?raw=true)
![Segment Skipped](./screenshots/2_sm.jpg?raw=true)

---

YouTube App with extended functionalities
## Features

![Configuration Screen](https://github.com/webosbrew/youtube-webos/blob/main/screenshots/1_sm.jpg?raw=true)
![Segment Skipped](https://github.com/webosbrew/youtube-webos/blob/main/screenshots/2_sm.jpg?raw=true)
- Ad Blocking
- [SponsorBlock](https://sponsor.ajay.app/) Integration
- [Autostart Support](#autostart)
- Force Highest Video Quality
- Audio-Only Mode (🟦 Blue button on remote)
- Full Animation Support
- Shorts Removal
- Higher-Quality Thumbnails
- On-Screen Clock Overlay
- YouTube Logo Removal
- Remove end screens
- Bypass account selector screen

## Features
> [!NOTE]
> Press the 🟩 **Green** button on your remote to access the configuration screen.

- Advertisements blocking
- [SponsorBlock](https://sponsor.ajay.app/) integration
- [Autostart](#autostart)
---

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

## Pre-requisites
- Uninstall the official YouTube app before installing this one.

- Official YouTube app needs to be uninstalled before installation.
---

## Installation

- Use [webOS Homebrew Channel](https://github.com/webosbrew/webos-homebrew-channel) - app is published in official webosbrew repo
- Use [Device Manager app](https://github.com/webosbrew/dev-manager-desktop) - see [Releases](https://github.com/webosbrew/youtube-webos/releases) for a
prebuilt `.ipk` binary file
- Use [webOS TV CLI tools](https://webostv.developer.lge.com/develop/tools/cli-installation) -
`ares-install youtube...ipk` (For more information on configuring the webOS CLI tools, see [below](#development-tv-setup))
You can install the app using one of the following methods:

## Configuration
- **[webOS Homebrew Channel](https://github.com/webosbrew/webos-homebrew-channel):**
App is available in the official webOS Brew repository.
- **[Device Manager](https://github.com/webosbrew/dev-manager-desktop):**
Use a pre-built `.ipk` file from the [Releases](https://github.com/webosbrew/youtube-webos/releases) page.
- **Command Line (webOS CLI):** Configure the tools [below](#development-setup)

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

### Autostart
## Autostart

In order to autostart an application the following command needs to be executed
via SSH or Telnet:
To enable autostart, run the following command needs to be executed on the TV via **SSH** or **Telnet**:

```sh
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 allows the app to show up as an input source and launch automatically if it was the last used app. It will remain active in the background for faster startup (minor increase in idle memory usage).

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:
To disable autostart:

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

## Building
---

## Development Setup

### Pre-requisites

- The latest **Node.js** LTS release. Refer to `devEngines` in [`package.json`](package.json) for the minimum version.
- **pnpm**. If you already have `Node.js`, you can have it automatically setup by running `corepack enable`.
- **git**

### Setup

1. Clone the repository.

- Clone the repository
```sh
git clone https://github.com/webosbrew/youtube-webos.git
cd youtube-webos
```

2. Install dependencies.

```sh
pnpm install
```

### Building an IPK

```sh
git clone https://github.com/webosbrew/youtube-webos.git
pnpm run build:dev
pnpm run package
```

- Enter the folder and build the App, this will generate a `*.ipk` file.
The `.ipk` file will be generated in the project root directory. You can stop here if you're fine with installing the IPK via [the webOS Dev Manager app](https://github.com/webosbrew/dev-manager-desktop). Alternatively, continue below if you want to make it so you can install the IPK on your TV with one command.

```sh
cd youtube-webos
### On the TV

# Install dependencies (need to do this only when updating local repository / package.json is changed)
npm install
> [!IMPORTANT]
> If your TV is rooted, follow [the alternative setup section](#alternate-setup-rooted-tv) instead and then skip to [installing to the TV](#installing-to-the-tv)

npm run build && npm run package
1. Create an [LG Developer account](https://webostv.developer.lge.com/login)
2. Install the [**Developer Mode** app](https://in.lgappstv.com/main/tvapp/detail?appId=232503) from the LG Content Store
3. Navigate to the app, Log-in in with LG Developer Credentials and enable:
- Developer Mode
- Key Server

### Add the TV to the CLI

```sh
pnpm exec ares-setup-device
```

## Development TV setup
Follow the prompts:

These instructions use the [webOS CLI tools](https://github.com/webos-tools/cli).
See <https://webostv.developer.lge.com/develop/tools/cli-introduction> for more information.
1. Add device
2. Enter IP from the Developer Mode app
3. Use default values unless needed
4. Enter 6-digit passphrase shown on the TV screen

### Configuring webOS CLI tools with Developer Mode App
Verify:

This is partially based on <https://webostv.developer.lge.com/develop/getting-started/developer-mode-app>.
```sh
pnpm exec ares-setup-device --list
```

- Install Developer Mode app from Content Store
- Enable Developer Mode
- Enable key server and download TV's private key: `http://TV_IP:9991/webos_rsa`
The key must be saved under `~/.ssh` (or `%USERPROFILE%\.ssh` on Windows)
- Configure the device using `ares-setup-device` (`-a` may need to be replaced with `-m` if device named `webos` is already configured)
- `PASSPHRASE` is the 6-character passphrase printed on screen in developer mode app
- `privatekey` path is relative to `${HOME}/.ssh` (Windows: `%USERPROFILE%\.ssh`)
Sample output:

```log
name deviceinfo connection profile passphrase
-------------- ----------------------------- ---------- ------- ----------
mytv (default) prisoner@192.168.137.102:9922 ssh tv EF32E8
```

---

## Installing to the TV

```sh
ares-setup-device -a webos -i "username=prisoner" -i "privatekey=webos_rsa" -i "passphrase=PASSPHRASE" -i "host=TV_IP" -i "port=9922"
pnpm run deploy # Installs to the default device selected via `ares-setup-device`.
```

### Configuring webOS CLI tools with Homebrew Channel / root
## Debugging

- Enable SSH in Homebrew Channel app
- Generate SSH key on developer machine (`ssh-keygen -t rsa`)
- Copy the private key (`id_rsa`) to the `~/.ssh` directory (or `%USERPROFILE%\.ssh` on Windows) on the local computer
- Append the public key (`id_rsa.pub`) to the `/home/root/.ssh/authorized_keys` file on the TV
- Configure the device using `ares-setup-device` (`-a` may need to be replaced with `-m` if device named `webos` is already configured)
- `privatekey` path is relative to `${HOME}/.ssh` (Windows: `%USERPROFILE%\.ssh`)
webOS supports the standard Chrome Devtools Protocol which allows you to inspect the app.

```sh
ares-setup-device -a webos -i "username=root" -i "privatekey=id_rsa" -i "passphrase=SSH_KEY_PASSPHRASE" -i "host=TV_IP" -i "port=22"
ares-inspect -d <device_name> --app youtube.leanback.v4
```

## Installation
Or if you've set your TV as the default device:

```sh
npm run deploy
pnpm run inspect
```

## Launching
---

## Alternate Setup (Rooted TV)

1. Enable SSH via Homebrew Channel
2. Generate SSH key:

```sh
ssh-keygen -t rsa
```

3. Copy `id_rsa` to `~/.ssh` (Windows: `%USERPROFILE%\.ssh`)
4. Append `id_rsa.pub` to `/home/root/.ssh/authorized_keys` on the TV
5. Set up device:

```sh
ares-setup-device -a webos \
-i "username=root" \
-i "privatekey=id_rsa" \
-i "passphrase=SSH_KEY_PASSPHRASE" \
-i "host=TV_IP" \
-i "port=22"
```

---

## Quick Commands

- The app will be available in the TV's app list. You can also launch it using the webOS CLI tools.
### Build, Install, and Launch

```sh
npm run launch
pnpm run build:dev && pnpm run package && pnpm run deploy && pnpm run launch
```

To jump immediately into some specific video use:
To launch a specific video directly:

```sh
npm run launch -- -p '{"contentTarget":"v=F8PGWLvn1mQ"}'
pnpm run launch -- -p '{"contentTarget":"v=F8PGWLvn1mQ"}'
```
Loading