注意:由于新节点版本不支持它们,并且持续的安全更新和依赖项需要新的节点版本,因此已经退休了32位ARM构建(在其他主要玩家之后的整整一年)已退休。请迁移到64位OS,继续接收Metube升级。
YouTube-DL的Web GUI(使用YT-DLP叉)具有播放列表支持。允许您从YouTube和其他数十个网站下载视频。
docker run -d -p 8081:8081 -v /path/to/downloads:/downloads ghcr.io/alexta69/metube
services :
metube :
image : ghcr.io/alexta69/metube
container_name : metube
restart : unless-stopped
ports :
- " 8081:8081 "
volumes :
- /path/to/downloads:/downloads
可以使用docker命令行上的-e参数或docker -compose中的environment:
中的-e
参数来设置某些值。
1000
。1000
。022
。light
, dark
或auto
。默认为auto
。/downloads
和.
否则。DOWNLOAD_DIR
的值。true
,下载dirs( download_dir and audio_download_dir )在Web服务器上是可索引的。默认为false
。true
。true
。/downloads/.metube
和.
否则。/downloads
和.
否则。tmpfs
)以获得更好的性能true
,则在服务器中将下载的文件从UI的“已完成”部分丢弃时,将在服务器上删除。默认为false
。/
。https
而不是http
(需要CERTFILE和KEYFILE )。默认为false
。%(title)s.%(ext)s
。%(title)s - %(section_number)s %(section_title)s.%(ext)s
。%(playlist_title)s/%(title)s.%(ext)s
。空时,使用OUTPUT_TEMPLATE
。true
,则默认情况下将启用“严格播放列表模式”开关。在此模式下,仅当URL严格指向播放列表时,播放列表才会下载。播放列表中视频的URL将与直接视频URL相同。默认为false
。0
(无限制)。postprocessors
指定--recode-video
。另请注意,破折号被下划线取代。YTDL_OPTIONS
。请注意,如果指定了YTDL_OPTIONS_FILE
和YTDL_OPTIONS
,则YTDL_OPTIONS
中的选项优先。robots.txt
文件的路径安装在容器中YTDL_OPTIONS
的以下示例值嵌入了英文字幕和章节标记(用于具有它们的视频),并更改下载的视频上的权限,并将文件修改时间戳设置为下载的日期:
environment :
- ' YTDL_OPTIONS={"writesubtitles":true,"subtitleslangs":["en","-live_chat"],"updatetime":false,"postprocessors":[{"key":"Exec","exec_cmd":"chmod 0664","when":"after_move"},{"key":"FFmpegEmbedSubtitle","already_have_subtitle":false},{"key":"FFmpegMetadata","add_chapters":true}]} '
OUTPUT_TEMPLATE
集的以下示例值:
environment :
- ' OUTPUT_TEMPLATE=%(playlist_title&Playlist |)S%(playlist_title|)S%(playlist_uploader& by |)S%(playlist_uploader|)S%(playlist_autonumber& - |)S%(playlist_autonumber|)S%(playlist_count& of |)S%(playlist_count|)S%(playlist_autonumber& - |)S%(uploader,creator|UNKNOWN_AUTHOR)S - %(title|UNKNOWN_TITLE)S - %(release_date>%Y-%m-%d,upload_date>%Y-%m-%d|UNKNOWN_DATE)S.%(ext)s '
如果您需要与Metube一起使用浏览器的cookie,例如下载限制或私人视频:
volumes :
- /path/to/cookies:/cookies
environment :
- YTDL_OPTIONS={"cookiefile":"/cookies/cookies.txt"}
cookies.txt
浏览器扩展程序允许右键单击视频并将其直接发送到Metube。请注意,如果您在HTTPS页面上,则您的Metube实例必须在HTTPS反向代理后面(请参阅下文),以便可以使用的扩展名。
Chrome:由RPSL贡献。您可以从Google Chrome网络店安装它,也可以使用开发人员模式并从源安装。
Firefox:由纳米皮层贡献。您可以从Firefox插件安装它,也可以从此处获取来源。
Rithask创建了一个iOS快捷方式,将URL从Safari发送到Metube。最初,您需要输入服务器地址和端口,但是在此之后,它将被保存,并且您可以从Safari中的共享菜单中运行快捷方式。地址应包括协议(HTTP/HTTPS)和端口,如果不是默认的80/443。例如: https://metube.example.com
或http://192.168.1.1:8081
。快捷方式可以在这里找到。
iOS对视频文件有严格的要求,需要H264或H265视频编解码器和MP4容器中的AAC音频编解码器。有时,这可能比可用的最佳质量低。为了满足iOS要求,下载MP4格式时,您可以选择“最佳(iOS)”,以使最佳质量格式与iOS要求尽可能兼容。
Kushfest创建了一个Chrome Beammarklet,用于将当前打开的网页发送到Metube。请注意,如果您在HTTPS页面上,则必须将Metube实例与HTTPS
配置为环境中的true
,或者在HTTPS反向代理后面(见下文)以获取工作书签。
GitHub不允许嵌入JavaScript作为链接,因此必须通过将以下代码复制到您在书签栏上创建的新书签来手动创建书签。更改下面URL中的主机名,以指向您的Metube实例。
javascript: ! function ( ) { xhr = new XMLHttpRequest ( ) ; xhr . open ( "POST" , "https://metube.domain.com/add" ) ; xhr . withCredentials = true ; xhr . send ( JSON . stringify ( { "url" : document . location . href , "quality" : "best" } ) ) ; xhr . onload = function ( ) { if ( xhr . status == 200 ) { alert ( "Sent to metube!" ) } else { alert ( "Send to metube failed. Check the javascript console for clues." ) } } } ( ) ;
Shoonya75贡献了Firefox版本:
javascript: ( function ( ) { xhr = new XMLHttpRequest ( ) ; xhr . open ( "POST" , "https://metube.domain.com/add" ) ; xhr . send ( JSON . stringify ( { "url" : document . location . href , "quality" : "best" } ) ) ; xhr . onload = function ( ) { if ( xhr . status == 200 ) { alert ( "Sent to metube!" ) } else { alert ( "Send to metube failed. Check the javascript console for clues." ) } } } ) ( ) ;
以上书签使用alert()
作为成功/失败通知。以下将显示一条吐司消息:
铬合金:
javascript: ! function ( ) { function notify ( msg ) { var sc = document . scrollingElement . scrollTop ; var text = document . createElement ( 'span' ) ; text . innerHTML = msg ; var ts = text . style ; ts . all = 'revert' ; ts . color = '#000' ; ts . fontFamily = 'Verdana, sans-serif' ; ts . fontSize = '15px' ; ts . backgroundColor = 'white' ; ts . padding = '15px' ; ts . border = '1px solid gainsboro' ; ts . boxShadow = '3px 3px 10px' ; ts . zIndex = '100' ; document . body . appendChild ( text ) ; ts . position = 'absolute' ; ts . top = 50 + sc + 'px' ; ts . left = ( window . innerWidth / 2 ) - ( text . offsetWidth / 2 ) + 'px' ; setTimeout ( function ( ) { text . style . visibility = "hidden" ; } , 1500 ) ; } xhr = new XMLHttpRequest ( ) ; xhr . open ( "POST" , "https://metube.domain.com/add" ) ; xhr . send ( JSON . stringify ( { "url" : document . location . href , "quality" : "best" } ) ) ; xhr . onload = function ( ) { if ( xhr . status == 200 ) { notify ( "Sent to metube!" ) } else { notify ( "Send to metube failed. Check the javascript console for clues." ) } } } ( ) ;
Firefox:
javascript: ( function ( ) { function notify ( msg ) { var sc = document . scrollingElement . scrollTop ; var text = document . createElement ( 'span' ) ; text . innerHTML = msg ; var ts = text . style ; ts . all = 'revert' ; ts . color = '#000' ; ts . fontFamily = 'Verdana, sans-serif' ; ts . fontSize = '15px' ; ts . backgroundColor = 'white' ; ts . padding = '15px' ; ts . border = '1px solid gainsboro' ; ts . boxShadow = '3px 3px 10px' ; ts . zIndex = '100' ; document . body . appendChild ( text ) ; ts . position = 'absolute' ; ts . top = 50 + sc + 'px' ; ts . left = ( window . innerWidth / 2 ) - ( text . offsetWidth / 2 ) + 'px' ; setTimeout ( function ( ) { text . style . visibility = "hidden" ; } , 1500 ) ; } xhr = new XMLHttpRequest ( ) ; xhr . open ( "POST" , "https://metube.domain.com/add" ) ; xhr . send ( JSON . stringify ( { "url" : document . location . href , "quality" : "best" } ) ) ; xhr . onload = function ( ) { if ( xhr . status == 200 ) { notify ( "Sent to metube!" ) } else { notify ( "Send to metube failed. Check the javascript console for clues." ) } } } ) ( ) ;
DOTVHS为Raycast创建了一个扩展程序,该扩展名允许直接从Raycast中添加视频。
可以配置Metube以HTTPS模式聆听。 docker-compose
示例:
services :
metube :
image : ghcr.io/alexta69/metube
container_name : metube
restart : unless-stopped
ports :
- " 8081:8081 "
volumes :
- /path/to/downloads:/downloads
- /path/to/ssl/crt:/ssl/crt.pem
- /path/to/ssl/key:/ssl/key.pem
environment :
- HTTPS=true
- CERTFILE=/ssl/crt.pem
- KEYFILE=/ssl/key.pem
为了支持身份验证,也可以在反向代理后面运行metube。也可以以这种方式添加HTTPS支持。
当在重建URL的反向代理后面运行(即在子目录下使用Metube而不是根源)时,请不要忘记将URL_PREFIX环境变量设置为正确的值。
如果您使用Linuxserver/赃物图像来满足您的反向代理需求(我可以衷心建议),它已经包括在nginx/proxy-confs
目录中以配置体积中的subforter和子域模式代理metube的现成片段。它还包括可用于身份验证的authelia。
location /metube/ {
proxy_pass http://metube:8081;
proxy_http_version 1.1 ;
proxy_set_header Upgrade $http_upgrade ;
proxy_set_header Connection "upgrade" ;
proxy_set_header Host $host ;
}
注意:额外的proxy_set_header
指令在那里使WebSocket起作用。
由Pie-YT贡献。来源。
# For putting in your Apache sites site.conf
# Serves MeTube under a /metube/ subdir (http://yourdomain.com/metube/)
< Location /metube/>
ProxyPass http://localhost:8081/ retry=0 timeout=30
ProxyPassReverse http://localhost:8081/
</ Location >
< Location /metube/socket.io>
RewriteEngine On
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:8081/socket.io/$1 [P,L]
ProxyPass http://localhost:8081/socket.io retry=0 timeout=30
ProxyPassReverse http://localhost:8081/socket.io
</ Location >
下面的示例Caddyfile将在Caddy后面获得反向代理。
example.com {
route /metube/* {
uri strip_prefix metube
reverse_proxy metube :8081
}
}
在Metube中为实际视频下载提供动力的引擎是YT-DLP。由于视频站点定期更改其布局,因此需要频繁的YT-DLP更新才能跟上。
Metube有一个自动的夜间构建,它正在寻找新版本的YT-DLP,如果存在,则该构建将其拉动并发布更新的Docker映像。因此,为了跟上更改,建议您使用最新图像定期更新Metube容器。
我建议为此目的安装和设置守望台。
在提出问题或提交Metube问题之前,请记住Metube只是YT-DLP的UI。您可能会遇到的任何问题对视频网站进行身份验证,后处理,权限,其他似乎不起作用的YTDL_OPTIONS
配置,或其他与基础YT-DLP库的工作有关的其他内容,不必在Metube Project上打开。为了进行调试和故障排除,建议您先尝试直接使用YT-DLP二进制文件,绕过UI,一旦有效,将适用于您的选项导入到YTDL_OPTIONS
中。
为了直接使用YT-DLP命令进行测试,您可以下载并在本地运行它,或者为了更好地模拟其实际条件,您可以在Metube容器本身中运行它。假设您的Metube容器称为metube
,请在Docker主机上运行以下内容,以在容器内获取外壳:
docker exec -ti metube sh
cd /downloads
到达那里后,您可以自由使用YT-DLP命令。
Metube开发依靠社区的代码贡献。该程序当前站立的程序适合我自己的用例,因此,就我而言,它是完整的。如果您的用例不同并且需要其他功能,请随时提交实现这些功能的PR。建议首先创建一个问题来讨论计划的实施,因为为了减少膨胀,可能不接受一些PR。但是,请注意,当您不打算实施功能时,打开功能请求很少会导致请求得到满足。
确保安装了Node.js和Python 3.11。
cd metube/ui
# install Angular and build the UI
npm install
node_modules/.bin/ng build
# install python dependencies
cd ..
pip3 install pipenv
pipenv install
# run
pipenv run python3 app/main.py
可以在本地构建Docker映像(也将构建UI):
docker build -t metube .