Oct 29

1. 下载并安装 uBlock Origin

2. 打开插件, 点击右侧齿轮图标, 选择"自定义静态规则", 贴入以下代码:

youtube.com##+js(set, yt.config_.openPopupConfig.supportedPopups.adBlockMessageViewModel, false)
youtube.com##+js(set, Object.prototype.adBlocksFound, 0)
youtube.com##+js(set, ytplayer.config.args.raw_player_response.adPlacements, [])
youtube.com##+js(set, Object.prototype.hasAllowedInstreamAd, true)

3. 在 uBlock Origin 设定页面中,选择“规则列表”,按下“清除所有缓存”,接着按“立即更新”。

4. 在 Youtube 页面,关闭除了 uBlock Origin 以外的其它广告拦截器,如 Adblock。

5. 刷新页面即可。

6. 若突然无法观看,请重复步骤 3。


Oct 06

详情见 MeTube 主页,我这里流水账一下:

#安装、升级 npm / n
apt install npm
npm -g install n
n lts

cd metube/ui

# 安装 Angular,构建 UI
npm install
node_modules/.bin/ng build

# 安装 Python 依赖
cd ..
pip3 install pipenv
pipenv install
python3 -m pip install aiohttp
pipenv install aiohttp

#安装 ffmpeg,合并音频视频,Youtube 新视频基本都需要合并
apt install ffmpeg

# 自定义环境文件测试运行
export DOWNLOAD_DIR=/home/wwwroot/metube
export URL_PREFIX=/metube
pipenv run python3 app/main.py

正常会输出:

INFO:ytdl:waiting for item to download
======== Running on http://0.0.0.0:8081 ========
(Press CTRL+C to quit)

可以浏览器连接: http://VPS-IP:8081,测试一下下载,没问题往下走。

配置 Nginx 转发:

#主转发代码
        location /metube/ {
            proxy_pass http://127.0.0.1:8081;
            proxy_redirect off;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $host;
        }
#没有问题这一块可以不要
        location ~* .(css|js)$ {
            proxy_pass http://127.0.0.1:8081;
            proxy_redirect off;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $host;
        }

添加到开机自动运行:

systemctl edit metube --full --force

粘贴如下代码,metube 源码路径,下载路径,反代目录,改成自己的:

[Unit]
Description=Metube Web Service
After=network.target

[Service]
Environment=DOWNLOAD_DIR=/home/wwwroot/metube
Environment=URL_PREFIX=/metube
Restart=always
Type=simple
WorkingDirectory=/root/src/metube
ExecStart=/usr/local/bin/pipenv run python3 /root/src/metube/app/main.py

[Install]
WantedBy=multi-user.target

然后执行:

systemctl enable --now metube

metube 就启动了,并且下次开机也会自己启动。

追加:
添加简单的密码认证:

#生成密码文件,添加用户名
sudo sh -c "echo -n 'sammy:' >> /etc/nginx/.htpasswd"
#为此用户设置密码
sudo sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd"

然后添加到 metube 反代中:

location /metube/ {
    auth_basic           "Administrator’s Area";
    auth_basic_user_file /etc/nginx/.htpasswd";
    ...
}

Sep 26

一般内容用 IDM 下没啥问题,但是目前的 IDM 6.38.1 可以识别并下载 HDR 视频流,但是混流有 BUG,体现在 madVR 显示 HDR 内容不完善,导致 HDR 播放失败: IDM 6.41 下载的 HDR 已经没有问题。

试了一堆软件,youtube-dl 当然是可以的,但是命令行太烦躁。最后选择了下面两个:

1. 3D Youtube Downloader

2. 4K Video Downloader

3D Youtube Downloader 下载后封装为 webm 格式,4K Video Downloader 则封装为 mkv 格式,都可以完美识别播放 HDR 内容。

下载:


补充: MediaHuman YouTube Downloader 选择下载 WEBM 格式的视频, 并且不转换的话,也可以下载到 HDR 文件, 只是不如上面两个来的直观.
补充: MediaDownloader ,开源免费的,也很方便!

2023-08-28 增加: Gihosoft TubeGet