BASH脚本YouTube过滤
目标是能够将视频URL发送到两个Metube Dockers。一个仅适用于YouTube,一个用于YouTube以外的其他所有内容。
这个脚本将在我的手机中与Termux URL开启器一起使用,该脚本以参数$ url
打开
#!/bin/bash
# $url will contain a url to a video for processing on youtube-dl
# this will only take youtube urls and not others
if [[ $url =~ ['^(https?\:\/\/)?(www\.youtube\.com)\/.+$'] ]] || [[ $url =~ ['^(https?\:\/\/)?(www\.youtu\.be)\/.+$'] ]]
then
#curl -X POST https://metube.domain.com/add -H 'Content-Type: application/json' -d "{\"url\":\"$1\",\"quality\":\"1440p\"}"
echo "Sent To Metube"
fi
# this will take any url other then youtube
if [[ "$url" =~ ['^(https?\:\/\/)?(www\.a-zA-Z0-9\.com)\/.+$'] ]]
then
#curl -X POST https://metube2.domain.com/add -H 'Content-Type: application/json' -d "{\"url\":\"$1\",\"quality\":\"1440p\"}"
echo "Sent To Metube2"
fi
The goal is to be able to send video urls to two metube dockers. One just for YouTube and one for everything else but YouTube.
This script is going to go in my phone for use with termux url opener which opens as a argument $url
#!/bin/bash
# $url will contain a url to a video for processing on youtube-dl
# this will only take youtube urls and not others
if [[ $url =~ ['^(https?\:\/\/)?(www\.youtube\.com)\/.+
] ]] || [[ $url =~ ['^(https?\:\/\/)?(www\.youtu\.be)\/.+
] ]]
then
#curl -X POST https://metube.domain.com/add -H 'Content-Type: application/json' -d "{\"url\":\"$1\",\"quality\":\"1440p\"}"
echo "Sent To Metube"
fi
# this will take any url other then youtube
if [[ "$url" =~ ['^(https?\:\/\/)?(www\.a-zA-Z0-9\.com)\/.+
] ]]
then
#curl -X POST https://metube2.domain.com/add -H 'Content-Type: application/json' -d "{\"url\":\"$1\",\"quality\":\"1440p\"}"
echo "Sent To Metube2"
fi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论