Compare commits
13 Commits
snyk-fix-c
...
bcb61a922e
| Author | SHA1 | Date | |
|---|---|---|---|
| bcb61a922e | |||
| c046a76972 | |||
| ed25d11b23 | |||
| 8de5599240 | |||
| ce7fcc5d01 | |||
| 30ed2b5c75 | |||
| 12d4241668 | |||
| 0eb65f082c | |||
| 25fccc9a62 | |||
| 414a560205 | |||
| 7c1b8ed0a4 | |||
| 8084a175cf | |||
| f5175a6be7 |
136
README.md
@ -1,6 +1,6 @@
|
||||
<div align="center">
|
||||
|
||||
# YouTube Music
|
||||
# YTMD
|
||||
|
||||
[](https://github.com/th-ch/youtube-music/releases/)
|
||||
[](https://github.com/th-ch/youtube-music/blob/master/license)
|
||||
@ -14,31 +14,12 @@
|
||||
|
||||

|
||||
|
||||
|
||||
<div align="center">
|
||||
<a href="https://github.com/th-ch/youtube-music/releases/latest">
|
||||
<img src="web/youtube-music.svg" width="400" height="100" alt="YouTube Music SVG">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Read this in other languages: [한국어](./docs/readme/README-ko.md), [Française](./docs/readme/README-fr.md), [Íslenska](./docs/readme/README-is.md), [Español](./docs/readme/README-es.md), [Pусский](./docs/readme/README-ru.md), [Українська](./docs/readme/README-uk.md), [Magyar](./docs/readme/README-hu.md), [Português](./docs/readme/README-pt.md), [日本語](./docs/readme/README-ja.md)
|
||||
|
||||
**Electron wrapper around YouTube Music featuring:**
|
||||
|
||||
- Native look & feel, aims at keeping the original interface
|
||||
- Framework for custom plugins: change YouTube Music to your needs (style, content, features), enable/disable plugins in
|
||||
- Native look & feel extension, aims at keeping the original interface
|
||||
one click
|
||||
|
||||
## Demo Image
|
||||
|
||||
| Player Screen (album color theme & ambient light) |
|
||||
|:---------------------------------------------------------------------------------------------------------:|
|
||||
||
|
||||
|
||||
## Content
|
||||
|
||||
- [Features](#features)
|
||||
- [Available plugins](#available-plugins)
|
||||
- [Translation](#translation)
|
||||
- [Download](#download)
|
||||
- [Arch Linux](#arch-linux)
|
||||
@ -56,116 +37,6 @@ Read this in other languages: [한국어](./docs/readme/README-ko.md), [Françai
|
||||
- [License](#license)
|
||||
- [FAQ](#faq)
|
||||
|
||||
## Features:
|
||||
|
||||
- **Auto confirm when paused** (Always Enabled): disable
|
||||
the ["Continue Watching?"](https://user-images.githubusercontent.com/61631665/129977894-01c60740-7ec6-4bf0-9a2c-25da24491b0e.png)
|
||||
popup that pause music after a certain time
|
||||
|
||||
- And more ...
|
||||
|
||||
## Available plugins:
|
||||
|
||||
- **Ad Blocker**: Block all ads and tracking out of the box
|
||||
|
||||
- **Album Actions**: Adds Undislike, Dislike, Like, and Unlike buttons to apply this to all songs in a playlist or album
|
||||
|
||||
- **Album Color Theme**: Applies a dynamic theme and visual effects based on the album color palette
|
||||
|
||||
- **Ambient Mode**: Applies a lighting effect by casting gentle colors from the video, into your screen’s background
|
||||
|
||||
- **Audio Compressor**: Apply compression to audio (lowers the volume of the loudest parts of the signal and raises the
|
||||
volume of the softest parts)
|
||||
|
||||
- **Blur Navigation Bar**: makes navigation bar transparent and blurry
|
||||
|
||||
- **Bypass Age Restrictions**: bypass YouTube's age verification
|
||||
|
||||
- **Captions Selector**: Enable captions
|
||||
|
||||
- **Compact Sidebar**: Always set the sidebar in compact mode
|
||||
|
||||
- **Crossfade**: Crossfade between songs
|
||||
|
||||
- **Disable Autoplay**: Makes every song start in "paused" mode
|
||||
|
||||
- **[Discord](https://discord.com/) Rich Presence**: Show your friends what you listen to
|
||||
with [Rich Presence](https://user-images.githubusercontent.com/28219076/104362104-a7a0b980-5513-11eb-9744-bb89eabe0016.png)
|
||||
|
||||
- **Downloader**: downloads
|
||||
MP3 [directly from the interface](https://user-images.githubusercontent.com/61631665/129977677-83a7d067-c192-45e1-98ae-b5a4927393be.png) [(youtube-dl)](https://github.com/ytdl-org/youtube-dl)
|
||||
|
||||
- **Equalizer**: add filters to boost or cut specific range of frequencies (e.g. bass booster)
|
||||
|
||||
- **Exponential Volume**: Makes the volume
|
||||
slider [exponential](https://greasyfork.org/en/scripts/397686-youtube-music-fix-volume-ratio/) so it's easier to
|
||||
select lower volumes
|
||||
|
||||
- **In-App Menu**: [gives bars a fancy, dark look](https://user-images.githubusercontent.com/78568641/112215894-923dbf00-8c29-11eb-95c3-3ce15db27eca.png)
|
||||
|
||||
> (see [this post](https://github.com/th-ch/youtube-music/issues/410#issuecomment-952060709) if you have problem
|
||||
accessing the menu after enabling this plugin and hide-menu option)
|
||||
|
||||
- **Scrobbler**: Adds scrobbling support for [Last.fm](https://www.last.fm/) and [ListenBrainz](https://listenbrainz.org/)
|
||||
|
||||
- **Lumia Stream**: Adds [Lumia Stream](https://lumiastream.com/) support
|
||||
|
||||
- **Lyrics Genius**: Adds lyrics support for most songs
|
||||
|
||||
- **Music Together**: Share a playlist with others. When the host plays a song, everyone else will hear the same song
|
||||
|
||||
- **Navigation**: Next/Back navigation arrows directly integrated in the interface, like in your favorite browser
|
||||
|
||||
- **No Google Login**: Remove Google login buttons and links from the interface
|
||||
|
||||
- **Notifications**: Display a notification when a song starts
|
||||
playing ([interactive notifications](https://user-images.githubusercontent.com/78568641/114102651-63ce0e00-98d0-11eb-9dfe-c5a02bb54f9c.png)
|
||||
are available on windows)
|
||||
|
||||
- **Picture-in-picture**: allows to switch the app to picture-in-picture mode
|
||||
|
||||
- **Playback Speed**: Listen fast, listen
|
||||
slow! [Adds a slider that controls song speed](https://user-images.githubusercontent.com/61631665/129976003-e55db5ba-bf42-448c-a059-26a009775e68.png)
|
||||
|
||||
- **Precise Volume**: Control the volume precisely using mousewheel/hotkeys, with a custom hud and customizable volume
|
||||
steps
|
||||
|
||||
- **Shortcuts (& MPRIS)**: Allows setting global hotkeys for playback (play/pause/next/previous) +
|
||||
disable [media osd](https://user-images.githubusercontent.com/84923831/128601225-afa38c1f-dea8-4209-9f72-0f84c1dd8b54.png)
|
||||
by overriding media keys + enable Ctrl/CMD + F to search + enable linux mpris support for
|
||||
mediakeys + [custom hotkeys](https://github.com/Araxeus/youtube-music/blob/1e591d6a3df98449bcda6e63baab249b28026148/providers/song-controls.js#L13-L50)
|
||||
for [advanced users](https://github.com/th-ch/youtube-music/issues/106#issuecomment-952156902)
|
||||
|
||||
- **Skip Disliked Song**: Skips disliked songs
|
||||
|
||||
- **Skip Silences**: Automatically skip silenced sections
|
||||
|
||||
- [**SponsorBlock**](https://github.com/ajayyy/SponsorBlock): Automatically Skips non-music parts like intro/outro or
|
||||
parts of music videos where the song isn't playing
|
||||
|
||||
- **Synced Lyrics**: Provides synced lyrics to songs, using providers like [LRClib](https://lrclib.net).
|
||||
|
||||
- **Taskbar Media Control**: Control playback from
|
||||
your [Windows taskbar](https://user-images.githubusercontent.com/78568641/111916130-24a35e80-8a82-11eb-80c8-5021c1aa27f4.png)
|
||||
|
||||
- **TouchBar**: Custom TouchBar layout for macOS
|
||||
|
||||
- **Tuna OBS**: Integration with [OBS](https://obsproject.com/)'s
|
||||
plugin [Tuna](https://obsproject.com/forum/resources/tuna.843/)
|
||||
|
||||
- **Unobtrusive Player**: Prevents the player from popping up when playing a song
|
||||
|
||||
- **Video Quality Changer**: Allows changing the video quality with
|
||||
a [button](https://user-images.githubusercontent.com/78568641/138574366-70324a5e-2d64-4f6a-acdd-dc2a2b9cecc5.png) on
|
||||
the video overlay
|
||||
|
||||
- **Video Toggle**: Adds
|
||||
a [button](https://user-images.githubusercontent.com/28893833/173663950-63e6610e-a532-49b7-9afa-54cb57ddfc15.png) to
|
||||
switch between Video/Song mode. can also optionally remove the whole video tab
|
||||
|
||||
- **Visualizer**: Different music visualizers
|
||||
|
||||
|
||||
## Translation
|
||||
|
||||
You can help with translation on [Hosted Weblate](https://hosted.weblate.org/projects/youtube-music/).
|
||||
@ -355,8 +226,7 @@ export default createPlugin({
|
||||
enabled: false,
|
||||
}, // your custom config
|
||||
renderer() {
|
||||
// Remove the login button
|
||||
document.querySelector(".sign-in-link.ytmusic-nav-bar").remove();
|
||||
console.log('hello from renderer');
|
||||
} // define renderer hook
|
||||
});
|
||||
```
|
||||
|
||||
|
Before Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 600 B |
|
Before Width: | Height: | Size: 931 B |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 353 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 40 KiB |
@ -1,6 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 176 176" width="32" height="32">
|
||||
<circle fill="red" cx="88" cy="88" r="88"/>
|
||||
<path fill="#FFF"
|
||||
d="M88 46c23.1 0 42 18.8 42 42s-18.8 42-42 42-42-18.8-42-42 18.9-42 42-42m0-4c-25.4 0-46 20.6-46 46s20.6 46 46 46 46-20.6 46-46-20.6-46-46-46z"/>
|
||||
<path fill="#FFF" d="M72 111l39-24-39-22z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 353 B |
@ -150,6 +150,12 @@
|
||||
"visual-tweaks": {
|
||||
"label": "تعديلات المظهر",
|
||||
"submenu": {
|
||||
"custom-window-title": {
|
||||
"label": "عنوان نافذة مخصص",
|
||||
"prompt": {
|
||||
"placeholder": "مثال: YouTube Music"
|
||||
}
|
||||
},
|
||||
"like-buttons": {
|
||||
"default": "الافتراضي",
|
||||
"force-show": "اجبار الظهور",
|
||||
@ -414,6 +420,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"custom-output-device": {
|
||||
"menu": {
|
||||
"device-selector": "اختر جهاز"
|
||||
}
|
||||
},
|
||||
"disable-autoplay": {
|
||||
"description": "يجعل الأغنية تبدأ في وضع \"الإيقاف المؤقت\"",
|
||||
"menu": {
|
||||
@ -846,6 +857,18 @@
|
||||
"description": "يضيف أداة TouchBar لمستخدمي macOS",
|
||||
"name": "شريط اللمس (TouchBar)"
|
||||
},
|
||||
"transparent-player": {
|
||||
"menu": {
|
||||
"type": {
|
||||
"submenu": {
|
||||
"acrylic": "زجاجي",
|
||||
"mica": "حجري",
|
||||
"none": "لاشيء"
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": "مشغل شفاف"
|
||||
},
|
||||
"tuna-obs": {
|
||||
"description": "التكامل مع الإضافة\" Tuna\" الخاصة بـ OBS",
|
||||
"name": "إضافة Tuna OBS"
|
||||
|
||||
@ -150,6 +150,13 @@
|
||||
"visual-tweaks": {
|
||||
"label": "Визуални настройки",
|
||||
"submenu": {
|
||||
"custom-window-title": {
|
||||
"label": "Персонализирано заглавие на прозорец",
|
||||
"prompt": {
|
||||
"label": "Въведи персонализирано заглавие: (остави празно за да изключиш)",
|
||||
"placeholder": "Пример: Youtube Music"
|
||||
}
|
||||
},
|
||||
"like-buttons": {
|
||||
"default": "По подразбиране",
|
||||
"force-show": "Принудително показване",
|
||||
@ -414,6 +421,19 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"custom-output-device": {
|
||||
"description": "Конфигуриране на изходно медийно устройство за песни",
|
||||
"menu": {
|
||||
"device-selector": "Избери устройство"
|
||||
},
|
||||
"name": "Персонализирано изходно устройство",
|
||||
"prompt": {
|
||||
"device-selector": {
|
||||
"label": "Избери изходното медийно устройство",
|
||||
"title": "Избери изходно устройство"
|
||||
}
|
||||
}
|
||||
},
|
||||
"disable-autoplay": {
|
||||
"description": "Започва песента в паузиран режим",
|
||||
"menu": {
|
||||
@ -437,7 +457,15 @@
|
||||
"hide-duration-left": "Скрий оставащото време",
|
||||
"hide-github-button": "Скрий бутона за линк към GitHub",
|
||||
"play-on-youtube-music": "Възпроизведи в YouTube Music",
|
||||
"set-inactivity-timeout": "Задай таймаут за неактивност"
|
||||
"set-inactivity-timeout": "Задай таймаут за неактивност",
|
||||
"set-status-display-type": {
|
||||
"label": "Статус текст",
|
||||
"submenu": {
|
||||
"artist": "Слушам {artist}",
|
||||
"title": "Слушам {song title}",
|
||||
"youtube-music": "Слушам YouTube Music"
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": "Дискорд Разширен статус",
|
||||
"prompt": {
|
||||
@ -729,6 +757,7 @@
|
||||
"listenbrainz": {
|
||||
"token": "Въведете ListenBrainz потребителски токен"
|
||||
},
|
||||
"scrobble-alternative-artist": "Използвай алтернативни изпълнители",
|
||||
"scrobble-alternative-title": "Използвай алтернативни заглавия",
|
||||
"scrobble-other-media": "Скробъл на други медии"
|
||||
},
|
||||
@ -814,6 +843,14 @@
|
||||
"label": "Направете текстовете перфектно синхронизирани",
|
||||
"tooltip": "Изчислете до милисекунда показването на следващия ред (може да има малък ефект върху производителността)"
|
||||
},
|
||||
"preferred-provider": {
|
||||
"label": "Предпочитан доставчик",
|
||||
"none": {
|
||||
"label": "Празно",
|
||||
"tooltip": "Без предпочитан доставчик"
|
||||
},
|
||||
"tooltip": "Изберете доставчик по подразбиране"
|
||||
},
|
||||
"romanization": {
|
||||
"label": "Романизиране на текстовете",
|
||||
"tooltip": "Ако текстовете са на друг език, опитайте да покажете латинска версия."
|
||||
@ -846,6 +883,27 @@
|
||||
"description": "Добавя уиджет за TouchBar за потребители на macOS",
|
||||
"name": "TouchBar"
|
||||
},
|
||||
"transparent-player": {
|
||||
"description": "Прави прозореца на приложението прозрачен",
|
||||
"menu": {
|
||||
"opacity": {
|
||||
"label": "Прозрачност",
|
||||
"submenu": {
|
||||
"percent": "{{opacity}}%"
|
||||
}
|
||||
},
|
||||
"type": {
|
||||
"label": "Тип",
|
||||
"submenu": {
|
||||
"acrylic": "Акрил",
|
||||
"mica": "Слюда",
|
||||
"none": "Празно",
|
||||
"tabbed": "С раздели"
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": "Прозрачен плейър"
|
||||
},
|
||||
"tuna-obs": {
|
||||
"description": "Интеграция с плъгина Tuna за OBS",
|
||||
"name": "Tuna OBS"
|
||||
|
||||
@ -8,7 +8,8 @@
|
||||
"load-all": "Indlæser alle plugins",
|
||||
"load-failed": "Fejl ved indlæsning af plugin \"{{pluginName}}\"",
|
||||
"loaded": "Plugin \"{{pluginName}}\" indlæst",
|
||||
"unload-failed": "Fejl ved unload af plugin \"{{pluginName}}\""
|
||||
"unload-failed": "Fejl ved aflæsning af plugin \"{{pluginNavn}}\"",
|
||||
"unloaded": "Plugin \"{{pluginNavn}}\" aflæssede"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -98,6 +99,7 @@
|
||||
"auto-reset-app-cache": "Nulstil app cache når appen starter",
|
||||
"disable-hardware-acceleration": "Deaktiver hardware acceleration",
|
||||
"edit-config-json": "Rediger config.json",
|
||||
"override-user-agent": "Erstat Bruger-Agent",
|
||||
"restart-on-config-changes": "Genstart ved config ændringer",
|
||||
"set-proxy": {
|
||||
"label": "Indstil proxy",
|
||||
@ -130,22 +132,34 @@
|
||||
}
|
||||
},
|
||||
"resume-on-start": "Genoptag sidste sang når appen starter",
|
||||
"single-instance-lock": "Enkeltinstans lås",
|
||||
"start-at-login": "Start ved login",
|
||||
"starting-page": {
|
||||
"label": "Startside",
|
||||
"unset": "Ikke valgt"
|
||||
},
|
||||
"tray": {
|
||||
"label": "Bakke",
|
||||
"submenu": {
|
||||
"disabled": "Deaktiveret",
|
||||
"enabled-and-hide-app": "Bakke aktiveret, og skjul programvindue",
|
||||
"enabled-and-show-app": "Aktiver og vis app",
|
||||
"play-pause-on-click": "Start/Stop ved klik"
|
||||
}
|
||||
},
|
||||
"visual-tweaks": {
|
||||
"label": "Visuelle Justeringer",
|
||||
"submenu": {
|
||||
"custom-window-title": {
|
||||
"label": "Tilpasset vindues titel",
|
||||
"prompt": {
|
||||
"label": "Indtast tilpasset vindues titel: (lad være top for deaktiveret)",
|
||||
"placeholder": "Eksempel: YouTube Music"
|
||||
}
|
||||
},
|
||||
"like-buttons": {
|
||||
"default": "Standard",
|
||||
"force-show": "Tving visning",
|
||||
"hide": "Skjul",
|
||||
"label": "Like knapper"
|
||||
},
|
||||
@ -153,11 +167,15 @@
|
||||
"theme": {
|
||||
"dialog": {
|
||||
"button": {
|
||||
"cancel": "Annuller",
|
||||
"remove": "Fjern"
|
||||
}
|
||||
},
|
||||
"remove-theme": "Er du sikker på at du til fjerne det brugerdefinerede tema?",
|
||||
"remove-theme-message": "Dette vil fjerne det brugerdefinerede tema"
|
||||
},
|
||||
"label": "Tema",
|
||||
"submenu": {
|
||||
"import-css-file": "Importer brugerdefinerede CSS fil",
|
||||
"no-theme": "Intet tema"
|
||||
}
|
||||
}
|
||||
@ -173,6 +191,7 @@
|
||||
"view": {
|
||||
"label": "Vis",
|
||||
"submenu": {
|
||||
"force-reload": "Tving Genindlæs",
|
||||
"reload": "Genindlæs",
|
||||
"zoom-in": "Zoom ind",
|
||||
"zoom-out": "Zoom ud"
|
||||
|
||||
@ -79,7 +79,7 @@
|
||||
}
|
||||
},
|
||||
"menu": {
|
||||
"about": "À-propos",
|
||||
"about": "À propos",
|
||||
"navigation": {
|
||||
"label": "Navigation",
|
||||
"submenu": {
|
||||
@ -94,7 +94,7 @@
|
||||
"label": "Paramètres",
|
||||
"submenu": {
|
||||
"advanced-options": {
|
||||
"label": "Options avancée",
|
||||
"label": "Options avancées",
|
||||
"submenu": {
|
||||
"auto-reset-app-cache": "Réinitialiser le cache de l'application au démarrage",
|
||||
"disable-hardware-acceleration": "Désactiver les accélérations matérielles",
|
||||
@ -189,7 +189,7 @@
|
||||
"new": "NOUVEAU"
|
||||
},
|
||||
"view": {
|
||||
"label": "Vue",
|
||||
"label": "Fenêtre",
|
||||
"submenu": {
|
||||
"force-reload": "Forcer l'actualisation",
|
||||
"reload": "Actualiser",
|
||||
@ -765,7 +765,7 @@
|
||||
"prompt": {
|
||||
"lastfm": {
|
||||
"api-key": "Clé API de Last.fm",
|
||||
"api-secret": "API secret de Last.fm"
|
||||
"api-secret": "Secret de l'API de Last.fm"
|
||||
},
|
||||
"listenbrainz": {
|
||||
"token": {
|
||||
@ -796,7 +796,7 @@
|
||||
},
|
||||
"skip-disliked-songs": {
|
||||
"description": "Passer les musiques que je n'aime pas",
|
||||
"name": "Passer Chansons Déplaisantes"
|
||||
"name": "Passer les chansons « Je n'aime pas »"
|
||||
},
|
||||
"skip-silences": {
|
||||
"description": "Ignorer automatiquement les sections de silence dans les chansons",
|
||||
|
||||
1
src/plugins/adblocker/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/ad-blocker-engine.bin
|
||||
@ -1,58 +0,0 @@
|
||||
function skipAd(target: Element) {
|
||||
const skipButton = target.querySelector<HTMLButtonElement>(
|
||||
'button.ytp-ad-skip-button-modern',
|
||||
);
|
||||
if (skipButton) {
|
||||
skipButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
function speedUpAndMute(player: Element, isAdShowing: boolean) {
|
||||
const video = player.querySelector<HTMLVideoElement>('video');
|
||||
if (!video) return;
|
||||
if (isAdShowing) {
|
||||
video.playbackRate = 16;
|
||||
video.muted = true;
|
||||
} else if (!isAdShowing) {
|
||||
video.playbackRate = 1;
|
||||
video.muted = false;
|
||||
}
|
||||
}
|
||||
|
||||
export const loadAdSpeedup = () => {
|
||||
const player = document.querySelector<HTMLVideoElement>('#movie_player');
|
||||
if (!player) return;
|
||||
|
||||
new MutationObserver((mutations) => {
|
||||
for (const mutation of mutations) {
|
||||
if (
|
||||
mutation.type === 'attributes' &&
|
||||
mutation.attributeName === 'class'
|
||||
) {
|
||||
const target = mutation.target as HTMLElement;
|
||||
|
||||
const isAdShowing =
|
||||
target.classList.contains('ad-showing') ||
|
||||
target.classList.contains('ad-interrupting');
|
||||
speedUpAndMute(target, isAdShowing);
|
||||
}
|
||||
if (
|
||||
mutation.type === 'childList' &&
|
||||
mutation.addedNodes.length &&
|
||||
mutation.target instanceof HTMLElement
|
||||
) {
|
||||
skipAd(mutation.target);
|
||||
}
|
||||
}
|
||||
}).observe(player, {
|
||||
attributes: true,
|
||||
childList: true,
|
||||
subtree: true,
|
||||
});
|
||||
|
||||
const isAdShowing =
|
||||
player.classList.contains('ad-showing') ||
|
||||
player.classList.contains('ad-interrupting');
|
||||
speedUpAndMute(player, isAdShowing);
|
||||
skipAd(player);
|
||||
};
|
||||
@ -1,81 +0,0 @@
|
||||
// Used for caching
|
||||
import path from 'node:path';
|
||||
import fs, { promises } from 'node:fs';
|
||||
|
||||
import { ElectronBlocker } from '@ghostery/adblocker-electron';
|
||||
import { app, net } from 'electron';
|
||||
|
||||
const SOURCES = [
|
||||
'https://raw.githubusercontent.com/kbinani/adblock-youtube-ads/master/signed.txt',
|
||||
// UBlock Origin
|
||||
'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets/ublock-origin/filters.txt',
|
||||
'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets/ublock-origin/quick-fixes.txt',
|
||||
'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets/ublock-origin/unbreak.txt',
|
||||
'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets/ublock-origin/filters-2020.txt',
|
||||
'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets/ublock-origin/filters-2021.txt',
|
||||
'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets/ublock-origin/filters-2022.txt',
|
||||
'https://raw.githubusercontent.com/ghostery/adblocker/master/packages/adblocker/assets/ublock-origin/filters-2023.txt',
|
||||
// Fanboy Annoyances
|
||||
'https://secure.fanboy.co.nz/fanboy-annoyance_ubo.txt',
|
||||
// AdGuard
|
||||
'https://filters.adtidy.org/extension/ublock/filters/122_optimized.txt',
|
||||
];
|
||||
|
||||
let blocker: ElectronBlocker | undefined;
|
||||
|
||||
export const loadAdBlockerEngine = async (
|
||||
session: Electron.Session | undefined = undefined,
|
||||
cache: boolean = true,
|
||||
additionalBlockLists: string[] = [],
|
||||
disableDefaultLists: boolean | unknown[] = false,
|
||||
) => {
|
||||
// Only use cache if no additional blocklists are passed
|
||||
const cacheDirectory = path.join(app.getPath('userData'), 'adblock_cache');
|
||||
if (!fs.existsSync(cacheDirectory)) {
|
||||
fs.mkdirSync(cacheDirectory);
|
||||
}
|
||||
const cachingOptions =
|
||||
cache && additionalBlockLists.length === 0
|
||||
? {
|
||||
path: path.join(cacheDirectory, 'adblocker-engine.bin'),
|
||||
read: promises.readFile,
|
||||
write: promises.writeFile,
|
||||
}
|
||||
: undefined;
|
||||
const lists = [
|
||||
...((disableDefaultLists && !Array.isArray(disableDefaultLists)) ||
|
||||
(Array.isArray(disableDefaultLists) && disableDefaultLists.length > 0)
|
||||
? []
|
||||
: SOURCES),
|
||||
...additionalBlockLists,
|
||||
];
|
||||
|
||||
try {
|
||||
blocker = await ElectronBlocker.fromLists(
|
||||
(url: string) => net.fetch(url),
|
||||
lists,
|
||||
{
|
||||
enableCompression: true,
|
||||
// When generating the engine for caching, do not load network filters
|
||||
// So that enhancing the session works as expected
|
||||
// Allowing to define multiple webRequest listeners
|
||||
loadNetworkFilters: session !== undefined,
|
||||
},
|
||||
cachingOptions,
|
||||
);
|
||||
if (session) {
|
||||
blocker.enableBlockingInSession(session);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error loading adBlocker engine', error);
|
||||
}
|
||||
};
|
||||
|
||||
export const unloadAdBlockerEngine = (session: Electron.Session) => {
|
||||
if (blocker) {
|
||||
blocker.disableBlockingInSession(session);
|
||||
}
|
||||
};
|
||||
|
||||
export const isBlockerEnabled = (session: Electron.Session) =>
|
||||
blocker !== undefined && blocker.isBlockingEnabled(session);
|
||||
@ -1,148 +0,0 @@
|
||||
import { contextBridge, webFrame } from 'electron';
|
||||
|
||||
import { blockers } from './types';
|
||||
import { createPlugin } from '@/utils';
|
||||
import {
|
||||
isBlockerEnabled,
|
||||
loadAdBlockerEngine,
|
||||
unloadAdBlockerEngine,
|
||||
} from './blocker';
|
||||
|
||||
import { inject, isInjected } from './injectors/inject';
|
||||
import { loadAdSpeedup } from './adSpeedup';
|
||||
|
||||
import { t } from '@/i18n';
|
||||
|
||||
import type { BrowserWindow } from 'electron';
|
||||
|
||||
interface AdblockerConfig {
|
||||
/**
|
||||
* Whether to enable the adblocker.
|
||||
* @default true
|
||||
*/
|
||||
enabled: boolean;
|
||||
/**
|
||||
* When enabled, the adblocker will cache the blocklists.
|
||||
* @default true
|
||||
*/
|
||||
cache: boolean;
|
||||
/**
|
||||
* Which adblocker to use.
|
||||
* @default blockers.InPlayer
|
||||
*/
|
||||
blocker: (typeof blockers)[keyof typeof blockers];
|
||||
/**
|
||||
* Additional list of filters to use.
|
||||
* @example ["https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt"]
|
||||
* @default []
|
||||
*/
|
||||
additionalBlockLists: string[];
|
||||
/**
|
||||
* Disable the default blocklists.
|
||||
* @default false
|
||||
*/
|
||||
disableDefaultLists: boolean;
|
||||
}
|
||||
|
||||
export default createPlugin({
|
||||
name: () => t('plugins.adblocker.name'),
|
||||
description: () => t('plugins.adblocker.description'),
|
||||
restartNeeded: false,
|
||||
config: {
|
||||
enabled: true,
|
||||
cache: true,
|
||||
blocker: blockers.InPlayer,
|
||||
additionalBlockLists: [],
|
||||
disableDefaultLists: false,
|
||||
} as AdblockerConfig,
|
||||
menu: async ({ getConfig, setConfig }) => {
|
||||
const config = await getConfig();
|
||||
|
||||
return [
|
||||
{
|
||||
label: t('plugins.adblocker.menu.blocker'),
|
||||
submenu: Object.values(blockers).map((blocker) => ({
|
||||
label: blocker,
|
||||
type: 'radio',
|
||||
checked: (config.blocker || blockers.WithBlocklists) === blocker,
|
||||
click() {
|
||||
setConfig({ blocker });
|
||||
},
|
||||
})),
|
||||
},
|
||||
];
|
||||
},
|
||||
renderer: {
|
||||
async onPlayerApiReady(_, { getConfig }) {
|
||||
const config = await getConfig();
|
||||
if (config.blocker === blockers.AdSpeedup) {
|
||||
loadAdSpeedup();
|
||||
}
|
||||
},
|
||||
},
|
||||
backend: {
|
||||
mainWindow: null as BrowserWindow | null,
|
||||
async start({ getConfig, window }) {
|
||||
const config = await getConfig();
|
||||
this.mainWindow = window;
|
||||
|
||||
if (config.blocker === blockers.WithBlocklists) {
|
||||
await loadAdBlockerEngine(
|
||||
window.webContents.session,
|
||||
config.cache,
|
||||
config.additionalBlockLists,
|
||||
config.disableDefaultLists,
|
||||
);
|
||||
}
|
||||
},
|
||||
stop({ window }) {
|
||||
if (isBlockerEnabled(window.webContents.session)) {
|
||||
unloadAdBlockerEngine(window.webContents.session);
|
||||
}
|
||||
},
|
||||
async onConfigChange(newConfig) {
|
||||
if (this.mainWindow) {
|
||||
if (
|
||||
newConfig.blocker === blockers.WithBlocklists &&
|
||||
!isBlockerEnabled(this.mainWindow.webContents.session)
|
||||
) {
|
||||
await loadAdBlockerEngine(
|
||||
this.mainWindow.webContents.session,
|
||||
newConfig.cache,
|
||||
newConfig.additionalBlockLists,
|
||||
newConfig.disableDefaultLists,
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
preload: {
|
||||
// see #1478
|
||||
script: `const _prunerFn = window._pruner;
|
||||
window._pruner = undefined;
|
||||
JSON.parse = new Proxy(JSON.parse, {
|
||||
apply() {
|
||||
return _prunerFn(Reflect.apply(...arguments));
|
||||
},
|
||||
});
|
||||
Response.prototype.json = new Proxy(Response.prototype.json, {
|
||||
apply() {
|
||||
return Reflect.apply(...arguments).then((o) => _prunerFn(o));
|
||||
},
|
||||
}); 0`,
|
||||
async start({ getConfig }) {
|
||||
const config = await getConfig();
|
||||
|
||||
if (config.blocker === blockers.InPlayer && !isInjected()) {
|
||||
inject(contextBridge);
|
||||
await webFrame.executeJavaScript(this.script);
|
||||
}
|
||||
},
|
||||
async onConfigChange(newConfig) {
|
||||
if (newConfig.blocker === blockers.InPlayer && !isInjected()) {
|
||||
inject(contextBridge);
|
||||
await webFrame.executeJavaScript(this.script);
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
@ -1,3 +0,0 @@
|
||||
export default async () => {
|
||||
await import('@ghostery/adblocker-electron-preload');
|
||||
};
|
||||
5
src/plugins/adblocker/injectors/inject.d.ts
vendored
@ -1,5 +0,0 @@
|
||||
import type { ContextBridge } from 'electron';
|
||||
|
||||
export const inject: (contextBridge: ContextBridge) => void;
|
||||
|
||||
export const isInjected: () => boolean;
|
||||
@ -1,259 +0,0 @@
|
||||
/* eslint-disable */
|
||||
|
||||
// Source: https://addons.mozilla.org/en-US/firefox/addon/adblock-for-youtube/
|
||||
// https://robwu.nl/crxviewer/?crx=https%3A%2F%2Faddons.mozilla.org%2Fen-US%2Ffirefox%2Faddon%2Fadblock-for-youtube%2F
|
||||
|
||||
/*
|
||||
Parts of this code is derived from set-constant.js:
|
||||
https://github.com/gorhill/uBlock/blob/5de0ce975753b7565759ac40983d31978d1f84ca/assets/resources/scriptlets.js#L704
|
||||
*/
|
||||
|
||||
let injected = false;
|
||||
|
||||
export const isInjected = () => injected;
|
||||
|
||||
/**
|
||||
* @param {Electron.ContextBridge} contextBridge
|
||||
* @returns {*}
|
||||
*/
|
||||
export const inject = (contextBridge) => {
|
||||
injected = true;
|
||||
{
|
||||
const pruner = function (o) {
|
||||
delete o.playerAds;
|
||||
delete o.adPlacements;
|
||||
delete o.adSlots;
|
||||
//
|
||||
if (o.playerResponse) {
|
||||
delete o.playerResponse.playerAds;
|
||||
delete o.playerResponse.adPlacements;
|
||||
delete o.playerResponse.adSlots;
|
||||
}
|
||||
if (o.ytInitialPlayerResponse) {
|
||||
delete o.ytInitialPlayerResponse.playerAds;
|
||||
delete o.ytInitialPlayerResponse.adPlacements;
|
||||
delete o.ytInitialPlayerResponse.adSlots;
|
||||
}
|
||||
|
||||
//
|
||||
return o;
|
||||
}
|
||||
|
||||
contextBridge.exposeInMainWorld('_pruner', pruner);
|
||||
}
|
||||
|
||||
const chains = [
|
||||
{
|
||||
chain: 'playerResponse.adPlacements',
|
||||
cValue: 'undefined',
|
||||
},
|
||||
{
|
||||
chain: 'ytInitialPlayerResponse.playerAds',
|
||||
cValue: 'undefined',
|
||||
},
|
||||
{
|
||||
chain: 'ytInitialPlayerResponse.adPlacements',
|
||||
cValue: 'undefined',
|
||||
},
|
||||
{
|
||||
chain: 'ytInitialPlayerResponse.adSlots',
|
||||
cValue: 'undefined',
|
||||
}
|
||||
];
|
||||
|
||||
chains.forEach(function ({ chain, cValue }) {
|
||||
const thisScript = document.currentScript;
|
||||
//
|
||||
switch (cValue) {
|
||||
case 'null': {
|
||||
cValue = null;
|
||||
break;
|
||||
}
|
||||
|
||||
case "''": {
|
||||
cValue = '';
|
||||
break;
|
||||
}
|
||||
|
||||
case 'true': {
|
||||
cValue = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'false': {
|
||||
cValue = false;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'undefined': {
|
||||
cValue = undefined;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'noopFunc': {
|
||||
cValue = function () {};
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 'trueFunc': {
|
||||
cValue = function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 'falseFunc': {
|
||||
cValue = function () {
|
||||
return false;
|
||||
};
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
if (/^\d+$/.test(cValue)) {
|
||||
cValue = Number.parseFloat(cValue);
|
||||
//
|
||||
if (isNaN(cValue)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Math.abs(cValue) > 0x7f_ff) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
let aborted = false;
|
||||
const mustAbort = function (v) {
|
||||
if (aborted) {
|
||||
return true;
|
||||
}
|
||||
|
||||
aborted =
|
||||
v !== undefined &&
|
||||
v !== null &&
|
||||
cValue !== undefined &&
|
||||
cValue !== null &&
|
||||
typeof v !== typeof cValue;
|
||||
return aborted;
|
||||
};
|
||||
|
||||
/*
|
||||
Support multiple trappers for the same property:
|
||||
https://github.com/uBlockOrigin/uBlock-issues/issues/156
|
||||
*/
|
||||
|
||||
const trapProp = function (owner, prop, configurable, handler) {
|
||||
if (handler.init(owner[prop]) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
const odesc = Object.getOwnPropertyDescriptor(owner, prop);
|
||||
let previousGetter;
|
||||
let previousSetter;
|
||||
if (odesc instanceof Object) {
|
||||
if (odesc.configurable === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (odesc.get instanceof Function) {
|
||||
previousGetter = odesc.get;
|
||||
}
|
||||
|
||||
if (odesc.set instanceof Function) {
|
||||
previousSetter = odesc.set;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
Object.defineProperty(owner, prop, {
|
||||
configurable,
|
||||
get() {
|
||||
if (previousGetter !== undefined) {
|
||||
previousGetter();
|
||||
}
|
||||
|
||||
//
|
||||
return handler.getter();
|
||||
},
|
||||
set(a) {
|
||||
if (previousSetter !== undefined) {
|
||||
previousSetter(a);
|
||||
}
|
||||
|
||||
//
|
||||
handler.setter(a);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const trapChain = function (owner, chain) {
|
||||
const pos = chain.indexOf('.');
|
||||
if (pos === -1) {
|
||||
trapProp(owner, chain, false, {
|
||||
v: undefined,
|
||||
getter() {
|
||||
return document.currentScript === thisScript ? this.v : cValue;
|
||||
},
|
||||
setter(a) {
|
||||
if (mustAbort(a) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
cValue = a;
|
||||
},
|
||||
init(v) {
|
||||
if (mustAbort(v)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
this.v = v;
|
||||
return true;
|
||||
},
|
||||
});
|
||||
//
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
const prop = chain.slice(0, pos);
|
||||
const v = owner[prop];
|
||||
//
|
||||
chain = chain.slice(pos + 1);
|
||||
if (v instanceof Object || (typeof v === 'object' && v !== null)) {
|
||||
trapChain(v, chain);
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
trapProp(owner, prop, true, {
|
||||
v: undefined,
|
||||
getter() {
|
||||
return this.v;
|
||||
},
|
||||
setter(a) {
|
||||
this.v = a;
|
||||
if (a instanceof Object) {
|
||||
trapChain(a, chain);
|
||||
}
|
||||
},
|
||||
init(v) {
|
||||
this.v = v;
|
||||
return true;
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
//
|
||||
trapChain(window, chain);
|
||||
});
|
||||
};
|
||||
@ -1,5 +0,0 @@
|
||||
export const blockers = {
|
||||
WithBlocklists: 'With blocklists',
|
||||
InPlayer: 'In player',
|
||||
AdSpeedup: 'Ad speedup',
|
||||
} as const;
|
||||
@ -1,13 +0,0 @@
|
||||
import { inject } from 'simple-youtube-age-restriction-bypass';
|
||||
|
||||
import { createPlugin } from '@/utils';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
export default createPlugin({
|
||||
name: () => t('plugins.bypass-age-restrictions.name'),
|
||||
description: () => t('plugins.bypass-age-restrictions.description'),
|
||||
restartNeeded: true,
|
||||
|
||||
// See https://github.com/organization/Simple-YouTube-Age-Restriction-Bypass#userscript
|
||||
renderer: () => inject(),
|
||||
});
|
||||
@ -1,3 +0,0 @@
|
||||
declare module 'simple-youtube-age-restriction-bypass' {
|
||||
export const inject: () => void;
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
import style from './style.css?inline';
|
||||
import { createPlugin } from '@/utils';
|
||||
import { t } from '@/i18n';
|
||||
|
||||
export default createPlugin({
|
||||
name: () => t('plugins.no-google-login.name'),
|
||||
description: () => t('plugins.no-google-login.description'),
|
||||
restartNeeded: true,
|
||||
config: {
|
||||
enabled: false,
|
||||
},
|
||||
stylesheets: [style],
|
||||
renderer() {
|
||||
const elementsToRemove = [
|
||||
'.sign-in-link.ytmusic-nav-bar',
|
||||
'.ytmusic-pivot-bar-renderer[tab-id="FEmusic_liked"]',
|
||||
];
|
||||
|
||||
for (const selector of elementsToRemove) {
|
||||
const node = document.querySelector(selector);
|
||||
if (node) {
|
||||
node.remove();
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
@ -1,6 +0,0 @@
|
||||
.ytmusic-pivot-bar-renderer[tab-id='FEmusic_liked'],
|
||||
ytmusic-guide-signin-promo-renderer,
|
||||
a[href='/music_premium'],
|
||||
.sign-in-link {
|
||||
display: none !important;
|
||||
}
|
||||