Fix WidevineCdm download (#578)

* implement new WidevineCdm extraction from crx3.

* fix widevinecdm folder.

* use m1k1o/go-crx3.
This commit is contained in:
Miroslav Šedivý
2025-09-14 17:27:28 +02:00
committed by GitHub
parent aeef3800f0
commit 14777501ee
5 changed files with 105 additions and 29 deletions
+5 -5
View File
@@ -3,6 +3,8 @@ FROM $BASE_IMAGE
ARG API_URL="https://api.github.com/repos/macchrome/linchrome/releases/latest"
COPY ./widevinecdm.sh /widevine.sh
#
# install custom chromium build from woolyss with support for hevc/x265
SHELL ["/bin/bash", "-c"]
@@ -21,11 +23,9 @@ RUN set -eux; apt-get update; \
chmod 4755 /usr/lib/chromium/chrome-sandbox; \
#
# install widevine module
WIDEVINE_VERSION=$(wget --quiet -O - https://dl.google.com/widevine-cdm/versions.txt | sort --version-sort | tail -n 1); \
wget -O /tmp/widevine.zip "https://dl.google.com/widevine-cdm/${WIDEVINE_VERSION}-linux-x64.zip"; \
unzip -p /tmp/widevine.zip libwidevinecdm.so > /usr/lib/chromium/libwidevinecdm.so; \
chmod 644 /usr/lib/chromium/libwidevinecdm.so; \
rm /tmp/widevine.zip; \
CHROMIUM_DIR="/usr/lib/chromium"; \
./widevine.sh "${CHROMIUM_DIR}/WidevineCdm"; \
rm -f /widevine.sh; \
#
# install latest version of uBlock Origin and SponsorBlock for YouTube
CHROMIUM_VERSION="$(wget -O - "${API_URL}" 2>/dev/null | jq -r ".tag_name" | sed -e 's/v//' -e 's/-.*//')"; \
+44
View File
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
set -e
TARGET_DIR="$(realpath "$1")"
if [ -z "$TARGET_DIR" ]; then
echo "Usage: $0 /path/to/install/WidevineCdm"
exit 1
fi
TMPDIR=$(mktemp -d)
cd "$TMPDIR"
function cleanup {
rm -rf "$TMPDIR"
}
trap cleanup EXIT
# Fetch manifest and extract URL
URL=$(python3 -c "
import json, urllib.request
data = json.load(urllib.request.urlopen('https://raw.githubusercontent.com/mozilla/gecko-dev/master/toolkit/content/gmp-sources/widevinecdm.json'))
for v in data['vendors'].values():
for k, p in v['platforms'].items():
if 'Linux_x86_64-gcc3' in k:
print(p['fileUrl'])
break
")
# Download CRX
curl -L -o widevinecdm.crx "$URL"
# Install go-crx3
echo "Fetching latest go-crx3 version..."
VERSION=$(curl -s https://api.github.com/repos/m1k1o/go-crx3/releases/latest | grep 'tag_name' | cut -d '"' -f4)
ARTIFACT="go-crx3_${VERSION#v}_linux_amd64.tar.gz"
URL="https://github.com/m1k1o/go-crx3/releases/download/${VERSION}/${ARTIFACT}"
echo "Downloading $URL"
curl -L -o "$ARTIFACT" "$URL"
tar -xzf "$ARTIFACT"
# Unpack with go-crx3
./go-crx3 unpack widevinecdm.crx
mkdir -p "$TARGET_DIR"
cp -ar widevinecdm/* "$TARGET_DIR"