BASH脚本YouTube过滤

发布于 2025-01-28 07:28:21 字数 853 浏览 2 评论 0原文

目标是能够将视频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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文