文章说明:本篇介绍使用Linux的bash命令拉取github中的域名列表,然后通过脚本整合成txt文件,在调用到openwrt中的passwall插件里实现域名分流功能。

1、创建路径

mkdir /root/domain/openai && cd /root/domain/openai

2、创建脚本

nano openai.sh

3、粘贴脚本

下面这个是OpenAI域名脚本

#!/bin/bash

# 第一步:下载域名内容到临时txt
wget -O /root/domain/openai/temp_openai.yaml_1 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/OpenAI/OpenAI.yaml
wget -O /root/domain/openai/temp_openai.yaml_2 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/OpenAI/OpenAI.yaml
wget -O /root/domain/openai/temp_openai.yaml_3 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/OpenAI/OpenAI.yaml
wget -O /root/domain/openai/temp_openai.yaml_4 https://raw.githubusercontent.com/LM-Firefly/Rules/master/PROXY/OpenAi.list
wget -O /root/domain/openai/temp_openai.yaml_5 https://gitlab.com/lodepuly/vpn_tool/-/raw/master/Tool/Loon/Rule/OpenAI.list
wget -O /root/domain/openai/temp_openai.yaml_6 https://gitlab.com/lodepuly/vpn_tool/-/raw/master/Tool/Loon/Rule/ChatGPT_Voice.list

# 合并下载的内容到 domain.txt
cat /root/domain/openai/temp_openai.yaml_* >> /root/domain/openai/domain.txt

# 第二步:提取 DOMAIN 和 DOMAIN-SUFFIX 内容到 1.txt
grep -E "DOMAIN,|DOMAIN-SUFFIX," /root/domain/openai/domain.txt | awk '{ if ($1 == "-") print $2; else print $3 }' | sed 's/^ *//;s/ *$//' > /root/domain/openai/1.txt

# 第三步:从 1.txt 提取内容到 2.txt
awk -F',' '{print $2}' /root/domain/openai/1.txt > /root/domain/openai/2.txt

# 第四步:从 2.txt 去重并输出到 3.txt
awk '!seen[$0]++' /root/domain/openai/2.txt > /root/domain/openai/3.txt

# 删除临时文件
rm /root/domain/openai/temp_openai.yaml_*

echo "Success !!!"

4、赋权脚本

chmod +x openai.sh

5、手动执行

看到最后输出Success !!!说明已完成。

./openai.sh

yydy_2024-01-02_14-25-00

6、查看3.txt

cat 3.txt

yydy_2024-01-02_14-44-24

7、配置cron

sudo apt install -y cron;sudo systemctl start cron;sudo systemctl enable cron
crontab -e

8、配置cron

每日凌晨五点自动执行脚本

0 5 * * * /root/domain/openai/openai.sh

9、内容拓展

整理好了几个国外常用的域名脚本

9.1、AWS

AWS收集脚本

#!/bin/bash

# 第一步:下载域名内容到临时txt
wget -O /root/domain/aws/temp_aws.yaml_1 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Amazon/Amazon.yaml
wget -O /root/domain/aws/temp_aws.yaml_2 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Amazon/Amazon.yaml
wget -O /root/domain/aws/temp_aws.yaml_3 https://fastly.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Amazon/Amazon.yaml
wget -O /root/domain/aws/temp_aws.yaml_4 https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Amazon.list
wget -O /root/domain/aws/temp_aws.yaml_5 https://raw.githubusercontent.com/LM-Firefly/Rules/master/PROXY/Amazon.list

# 合并下载的内容到 domain.txt
cat /root/domain/aws/temp_aws.yaml_* >> /root/domain/aws/domain.txt

# 第二步:提取 DOMAIN 和 DOMAIN-SUFFIX 内容到 1.txt
grep -E "DOMAIN,|DOMAIN-SUFFIX," /root/domain/aws/domain.txt | awk '{ if ($1 == "-") print $2; else print $3 }' | sed 's/^ *//;s/ *$//' > /root/domain/aws/1.txt

# 第三步:从 1.txt 提取内容到 2.txt
awk -F',' '{print $2}' /root/domain/aws/1.txt > /root/domain/aws/2.txt

# 第四步:从 2.txt 去重并输出到 3.txt
awk '!seen[$0]++' /root/domain/aws/2.txt > /root/domain/aws/3.txt

# 删除临时文件
rm /root/domain/aws/temp_aws.yaml_*

echo "Success !!!"

9.2、Facebook

Facebook收集脚本

#!/bin/bash

# 第一步:下载域名内容到临时txt
wget -O /root/domain/facebook/temp_facebook.yaml_1 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Facebook/Facebook.yaml
wget -O /root/domain/facebook/temp_facebook.yaml_2 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Facebook/Facebook.yaml
wget -O /root/domain/facebook/temp_facebook.yaml_3 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Facebook/Facebook.yaml
wget -O /root/domain/facebook/temp_facebook.yaml_4 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/release/rule/Clash/Facebook/Facebook.yaml
wget -O /root/domain/facebook/temp_facebook.yaml_5 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@release/rule/Clash/Facebook/Facebook.yaml
wget -O /root/domain/facebook/temp_facebook.yaml_6 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/release/rule/Clash/Facebook/Facebook.yaml
wget -O /root/domain/facebook/temp_facebook.yaml_7 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/source/rule/Facebook/Facebook.list
wget -O /root/domain/facebook/temp_facebook.yaml_8 https://raw.githubusercontent.com/sve1r/Rules-For-Quantumult-X/develop/Rules/Services/SNS/Facebook.list
wget -O /root/domain/facebook/temp_facebook.yaml_9 https://raw.githubusercontent.com/LM-Firefly/Rules/master/PROXY/Facebook.list
wget -O /root/domain/facebook/temp_facebook.yaml_10 https://raw.githubusercontent.com/LM-Firefly/Rules/master/Clash-RuleSet-Classical/PROXY/Facebook.yaml
wget -O /root/domain/facebook/temp_facebook.yaml_11 https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Facebook.list
wget -O /root/domain/facebook/temp_facebook.yaml_12 https://raw.githubusercontent.com/tkzc11/QX-Rules/main/Meta.list
wget -O /root/domain/facebook/temp_facebook.yaml_13 https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/Facebook.yaml

# 合并下载的内容到 domain.txt
cat /root/domain/facebook/temp_facebook.yaml_* >> /root/domain/facebook/domain.txt

# 第二步:提取 DOMAIN 和 DOMAIN-SUFFIX 内容到 1.txt
grep -E "DOMAIN,|DOMAIN-SUFFIX," /root/domain/facebook/domain.txt | awk '{ if ($1 == "-") print $2; else print $3 }' | sed 's/^ *//;s/ *$//' > /root/domain/facebook/1.txt

# 第三步:从 1.txt 提取内容到 2.txt
awk -F',' '{print $2}' /root/domain/facebook/1.txt > /root/domain/facebook/2.txt

# 第四步:从 2.txt 去重并输出到 3.txt
awk '!seen[$0]++' /root/domain/facebook/2.txt > /root/domain/facebook/3.txt

# 删除临时文件
rm /root/domain/facebook/temp_facebook.yaml_*

echo "Success !!!"

9.3、GitHub

GitHub收集脚本

#!/bin/bash

# 第一步:下载域名内容到临时txt
wget -O /root/domain/github/temp_github.yaml_1 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/GitHub/GitHub.yaml
wget -O /root/domain/github/temp_github.yaml_2 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/GitHub/GitHub.yaml
wget -O /root/domain/github/temp_github.yaml_3 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/GitHub/GitHub.yaml
wget -O /root/domain/github/temp_github.yaml_4 https://raw.githubusercontent.com/LM-Firefly/Rules/master/PROXY/Github.list
wget -O /root/domain/github/temp_github.yaml_5 https://raw.githubusercontent.com/LM-Firefly/Rules/master/Clash-RuleSet-Classical/PROXY/Github.yaml
wget -O /root/domain/github/temp_github.yaml_6 https://fastly.jsdelivr.net/gh/blackmatrix7/ios_rule_script@release/rule/Clash/GitHub/GitHub.yaml

# 合并下载的内容到 domain.txt
cat /root/domain/github/temp_github.yaml_* >> /root/domain/github/domain.txt

# 第二步:提取 DOMAIN 和 DOMAIN-SUFFIX 内容到 1.txt
grep -E "DOMAIN,|DOMAIN-SUFFIX," /root/domain/github/domain.txt | awk '{ if ($1 == "-") print $2; else print $3 }' | sed 's/^ *//;s/ *$//' > /root/domain/github/1.txt

# 第三步:从 1.txt 提取内容到 2.txt
awk -F',' '{print $2}' /root/domain/github/1.txt > /root/domain/github/2.txt

# 第四步:从 2.txt 去重并输出到 3.txt
awk '!seen[$0]++' /root/domain/github/2.txt > /root/domain/github/3.txt

# 删除临时文件
rm /root/domain/github/temp_github.yaml_*

echo "Success !!!"

9.4、Google

Google收集脚本

#!/bin/bash

# 第一步:下载域名内容到临时txt
wget -O /root/domain/google/temp_google.yaml_1 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Google/Google.yaml
wget -O /root/domain/google/temp_google.yaml_2 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Google/Google.yaml
wget -O /root/domain/google/temp_google.yaml_3 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Google/Google.yaml
wget -O /root/domain/google/temp_google.yaml_4 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/Extra/Google/GoogleDrive.list
wget -O /root/domain/google/temp_google.yaml_5 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/Extra/Google/GoogleSearch.list
wget -O /root/domain/google/temp_google.yaml_6 https://raw.githubusercontent.com/Loyalsoldier/surge-rules/release/ruleset/google.txt
wget -O /root/domain/google/temp_google.yaml_7 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Quantumult/Filter/Extra/Google/GoogleSearch.list
wget -O /root/domain/google/temp_google.yaml_8 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/source/rule/Google/Google.list
wget -O /root/domain/google/temp_google.yaml_9 https://raw.githubusercontent.com/sve1r/Rules-For-Quantumult-X/develop/Rules/Services/Google.list
wget -O /root/domain/google/temp_google.yaml_10 https://raw.githubusercontent.com/LM-Firefly/Rules/master/PROXY/Google.list
wget -O /root/domain/google/temp_google.yaml_11 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/Extra/Google/GoogleVoice.list
wget -O /root/domain/google/temp_google.yaml_12 https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/google.txt

# 合并下载的内容到 domain.txt
cat /root/domain/google/temp_google.yaml_* >> /root/domain/google/domain.txt

# 第二步:提取 DOMAIN 和 DOMAIN-SUFFIX 内容到 1.txt
grep -E "DOMAIN,|DOMAIN-SUFFIX," /root/domain/google/domain.txt | awk '{ if ($1 == "-") print $2; else print $3 }' | sed 's/^ *//;s/ *$//' > /root/domain/google/1.txt

# 第三步:从 1.txt 提取内容到 2.txt
awk -F',' '{print $2}' /root/domain/google/1.txt > /root/domain/google/2.txt

# 第四步:从 2.txt 去重并输出到 3.txt
awk '!seen[$0]++' /root/domain/google/2.txt > /root/domain/google/3.txt

# 删除临时文件
rm /root/domain/google/temp_google.yaml_*

echo "Success !!!"

9.5、Netflix

Netflix收集脚本

#!/bin/bash

# 第一步:下载域名内容到临时txt
wget -O /root/domain/netflix/temp_netflix.yaml_1 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Netflix/Netflix.yaml
wget -O /root/domain/netflix/temp_netflix.yaml_2 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Netflix/Netflix.yaml
wget -O /root/domain/netflix/temp_netflix.yaml_3 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Netflix/Netflix_Classical.yaml
wget -O /root/domain/netflix/temp_netflix.yaml_4 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Netflix/Netflix_Classical.yaml
wget -O /root/domain/netflix/temp_netflix.yaml_5 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Netflix/Netflix_Classical.yaml
wget -O /root/domain/netflix/temp_netflix.yaml_6 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Netflix/Netflix.yaml
wget -O /root/domain/netflix/temp_netflix.yaml_7 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/release/rule/Clash/Netflix/Netflix.yaml
wget -O /root/domain/netflix/temp_netflix.yaml_8 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/release/rule/Clash/Netflix/Netflix_Classical.yaml
wget -O /root/domain/netflix/temp_netflix.yaml_9 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@release/rule/Clash/Netflix/Netflix.yaml
wget -O /root/domain/netflix/temp_netflix.yaml_10 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@release/rule/Clash/Netflix/Netflix_Classical.yaml
wget -O /root/domain/netflix/temp_netflix.yaml_11 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/release/rule/Clash/Netflix/Netflix.yaml
wget -O /root/domain/netflix/temp_netflix.yaml_12 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/release/rule/Clash/Netflix/Netflix_Classical.yaml
wget -O /root/domain/netflix/temp_netflix.yaml_13 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/StreamingMedia/Video/Netflix.list
wget -O /root/domain/netflix/temp_netflix.yaml_14 https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Netflix.list
wget -O /root/domain/netflix/temp_netflix.yaml_15 https://raw.githubusercontent.com/GeQ1an/Rules/master/QuantumultX/Filter/Optional/Netflix.list
wget -O /root/domain/netflix/temp_netflix.yaml_16 https://raw.githubusercontent.com/LM-Firefly/Rules/master/Global-Services/Netflix.list
wget -O /root/domain/netflix/temp_netflix.yaml_17 https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/Netflix.yaml

# 合并下载的内容到 domain.txt
cat /root/domain/netflix/temp_netflix.yaml_* >> /root/domain/netflix/domain.txt

# 第二步:提取 DOMAIN 和 DOMAIN-SUFFIX 内容到 1.txt
grep -E "DOMAIN,|DOMAIN-SUFFIX," /root/domain/netflix/domain.txt | awk '{ if ($1 == "-") print $2; else print $3 }' | sed 's/^ *//;s/ *$//' > /root/domain/netflix/1.txt

# 第三步:从 1.txt 提取内容到 2.txt
awk -F',' '{print $2}' /root/domain/netflix/1.txt > /root/domain/netflix/2.txt

# 第四步:从 2.txt 去重并输出到 3.txt
awk '!seen[$0]++' /root/domain/netflix/2.txt > /root/domain/netflix/3.txt

# 删除临时文件
rm /root/domain/netflix/temp_netflix.yaml_*

echo "Success !!!"

9.6、Pinterest

Pinterest收集脚本

#!/bin/bash

# 第一步:下载域名内容到临时txt
wget -O /root/domain/pinterest/temp_pinterest.yaml_1 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Pinterest/Pinterest.yaml
wget -O /root/domain/pinterest/temp_pinterest.yaml_2 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Pinterest/Pinterest.yaml
wget -O /root/domain/pinterest/temp_pinterest.yaml_3 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Pinterest/Pinterest.yaml
wget -O /root/domain/pinterest/temp_pinterest.yaml_4 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/release/rule/Clash/Pinterest/Pinterest.yaml
wget -O /root/domain/pinterest/temp_pinterest.yaml_5 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@release/rule/Clash/Pinterest/Pinterest.yaml
wget -O /root/domain/pinterest/temp_pinterest.yaml_6 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/release/rule/Clash/Pinterest/Pinterest.yaml
wget -O /root/domain/pinterest/temp_pinterest.yaml_7 https://raw.githubusercontent.com/LM-Firefly/Rules/master/PROXY/Pinterest.list
wget -O /root/domain/pinterest/temp_pinterest.yaml_8 https://raw.githubusercontent.com/LM-Firefly/Rules/master/Clash-RuleSet-Classical/PROXY/Pinterest.yaml

# 合并下载的内容到 domain.txt
cat /root/domain/pinterest/temp_pinterest.yaml_* >> /root/domain/pinterest/domain.txt

# 第二步:提取 DOMAIN 和 DOMAIN-SUFFIX 内容到 1.txt
grep -E "DOMAIN,|DOMAIN-SUFFIX," /root/domain/pinterest/domain.txt | awk '{ if ($1 == "-") print $2; else print $3 }' | sed 's/^ *//;s/ *$//' > /root/domain/pinterest/1.txt

# 第三步:从 1.txt 提取内容到 2.txt
awk -F',' '{print $2}' /root/domain/pinterest/1.txt > /root/domain/pinterest/2.txt

# 第四步:从 2.txt 去重并输出到 3.txt
awk '!seen[$0]++' /root/domain/pinterest/2.txt > /root/domain/pinterest/3.txt

# 删除临时文件
rm /root/domain/pinterest/temp_pinterest.yaml_*

echo "Success !!!"

9.7、TikTok

TikTok收集脚本

#!/bin/bash

# 第一步:下载域名内容到临时txt
wget -O /root/domain/tiktok/temp_tiktok.yaml_1 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/TikTok/TikTok.yaml
wget -O /root/domain/tiktok/temp_tiktok.yaml_2 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/TikTok/TikTok.yaml
wget -O /root/domain/tiktok/temp_tiktok.yaml_3 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/StreamingMedia/Video/TikTok.list
wget -O /root/domain/tiktok/temp_tiktok.yaml_4 https://raw.githubusercontent.com/LM-Firefly/Rules/master/Global-Services/TikTok.list
wget -O /root/domain/tiktok/temp_tiktok.yaml_5 https://raw.githubusercontent.com/Semporia/Quantumult-X/master/Filter/TikTok.list

# 合并下载的内容到 domain.txt
cat /root/domain/tiktok/temp_tiktok.yaml_* >> /root/domain/tiktok/domain.txt

# 第二步:提取 DOMAIN 和 DOMAIN-SUFFIX 内容到 1.txt
grep -E "DOMAIN,|DOMAIN-SUFFIX," /root/domain/tiktok/domain.txt | awk '{ if ($1 == "-") print $2; else print $3 }' | sed 's/^ *//;s/ *$//' > /root/domain/tiktok/1.txt

# 第三步:从 1.txt 提取内容到 2.txt
awk -F',' '{print $2}' /root/domain/tiktok/1.txt > /root/domain/tiktok/2.txt

# 第四步:从 2.txt 去重并输出到 3.txt
awk '!seen[$0]++' /root/domain/tiktok/2.txt > /root/domain/tiktok/3.txt

# 删除临时文件
rm /root/domain/tiktok/temp_tiktok.yaml_*

echo "Success !!!"

9.8、Twitter

Twitter收集脚本

#!/bin/bash

# 第一步:下载域名内容到临时txt
wget -O /root/domain/twitter/temp_twitter.yaml_1 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Twitter/Twitter.yaml
wget -O /root/domain/twitter/temp_twitter.yaml_2 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Twitter/Twitter.yaml
wget -O /root/domain/twitter/temp_twitter.yaml_3 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Twitter/Twitter.yaml
wget -O /root/domain/twitter/temp_twitter.yaml_4 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/release/rule/Clash/Twitter/Twitter.yaml
wget -O /root/domain/twitter/temp_twitter.yaml_5 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@release/rule/Clash/Twitter/Twitter.yaml
wget -O /root/domain/twitter/temp_twitter.yaml_6 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/release/rule/Clash/Twitter/Twitter.yaml
wget -O /root/domain/twitter/temp_twitter.yaml_7 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/source/rule/Twitter/Twitter.list
wget -O /root/domain/twitter/temp_twitter.yaml_8 https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Twitter.list
wget -O /root/domain/twitter/temp_twitter.yaml_9 https://raw.githubusercontent.com/sve1r/Rules-For-Quantumult-X/develop/Rules/Services/SNS/Twitter.list
wget -O /root/domain/twitter/temp_twitter.yaml_10 https://raw.githubusercontent.com/LM-Firefly/Rules/master/PROXY/Twitter.list
wget -O /root/domain/twitter/temp_twitter.yaml_11 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/Extra/Twitter.list
wget -O /root/domain/twitter/temp_twitter.yaml_12 https://raw.githubusercontent.com/LM-Firefly/Rules/master/Clash-RuleSet-Classical/PROXY/Twitter.yaml
wget -O /root/domain/twitter/temp_twitter.yaml_13 https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/Twitter.yaml

# 合并下载的内容到 domain.txt
cat /root/domain/twitter/temp_twitter.yaml_* >> /root/domain/twitter/domain.txt

# 第二步:提取 DOMAIN 和 DOMAIN-SUFFIX 内容到 1.txt
grep -E "DOMAIN,|DOMAIN-SUFFIX," /root/domain/twitter/domain.txt | awk '{ if ($1 == "-") print $2; else print $3 }' | sed 's/^ *//;s/ *$//' > /root/domain/twitter/1.txt

# 第三步:从 1.txt 提取内容到 2.txt
awk -F',' '{print $2}' /root/domain/twitter/1.txt > /root/domain/twitter/2.txt

# 第四步:从 2.txt 去重并输出到 3.txt
awk '!seen[$0]++' /root/domain/twitter/2.txt > /root/domain/twitter/3.txt

# 删除临时文件
rm /root/domain/twitter/temp_twitter.yaml_*

echo "Success !!!"

9.9、WhatsApp

WhatsApp收集脚本

#!/bin/bash

# 第一步:下载域名内容到临时txt
wget -O /root/domain/whatsapp/temp_whatsapp.yaml_1 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Whatsapp/Whatsapp.yaml
wget -O /root/domain/whatsapp/temp_whatsapp.yaml_2 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Whatsapp/Whatsapp.yaml
wget -O /root/domain/whatsapp/temp_whatsapp.yaml_3 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Whatsapp/Whatsapp.yaml
wget -O /root/domain/whatsapp/temp_whatsapp.yaml_4 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/release/rule/Clash/Whatsapp/Whatsapp.yaml
wget -O /root/domain/whatsapp/temp_whatsapp.yaml_5 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@release/rule/Clash/Whatsapp/Whatsapp.yaml
wget -O /root/domain/whatsapp/temp_whatsapp.yaml_6 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/release/rule/Clash/Whatsapp/Whatsapp.yaml
wget -O /root/domain/whatsapp/temp_whatsapp.yaml_7 https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Whatsapp.list
wget -O /root/domain/whatsapp/temp_whatsapp.yaml_8 https://raw.githubusercontent.com/Hackl0us/SS-Rule-Snippet/master/Rulesets/Surge/App/social/WhatsApp.list
wget -O /root/domain/whatsapp/temp_whatsapp.yaml_9 https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/Whatsapp.yaml

# 合并下载的内容到 domain.txt
cat /root/domain/whatsapp/temp_whatsapp.yaml_* >> /root/domain/whatsapp/domain.txt

# 第二步:提取 DOMAIN 和 DOMAIN-SUFFIX 内容到 1.txt
grep -E "DOMAIN,|DOMAIN-SUFFIX," /root/domain/whatsapp/domain.txt | awk '{ if ($1 == "-") print $2; else print $3 }' | sed 's/^ *//;s/ *$//' > /root/domain/whatsapp/1.txt

# 第三步:从 1.txt 提取内容到 2.txt
awk -F',' '{print $2}' /root/domain/whatsapp/1.txt > /root/domain/whatsapp/2.txt

# 第四步:从 2.txt 去重并输出到 3.txt
awk '!seen[$0]++' /root/domain/whatsapp/2.txt > /root/domain/whatsapp/3.txt

# 删除临时文件
rm /root/domain/whatsapp/temp_whatsapp.yaml_*

echo "Success !!!"

9.10、Youtube

Youtube收集脚本

#!/bin/bash

# 第一步:下载域名内容到临时txt
wget -O /root/domain/youtube/temp_youtube.yaml_1 https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/YouTube/YouTube.yaml
wget -O /root/domain/youtube/temp_youtube.yaml_2 https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/YouTube/YouTube.yaml
wget -O /root/domain/youtube/temp_youtube.yaml_3 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/YouTube/YouTube.yaml
wget -O /root/domain/youtube/temp_youtube.yaml_4 https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/YouTube.list
wget -O /root/domain/youtube/temp_youtube.yaml_5 https://raw.githubusercontent.com/GeQ1an/Rules/master/QuantumultX/Filter/Optional/YouTube.list
wget -O /root/domain/youtube/temp_youtube.yaml_6 https://raw.githubusercontent.com/LM-Firefly/Rules/master/Global-Services/YouTube.list
wget -O /root/domain/youtube/temp_youtube.yaml_7 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Surge/Ruleset/StreamingMedia/Video/YouTube.list
wget -O /root/domain/youtube/temp_youtube.yaml_8 https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Providers/Ruleset/YouTube.yaml
wget -O /root/domain/youtube/temp_youtube.yaml_9 https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/release/rule/Clash/YouTube/YouTube.yaml

# 合并下载的内容到 domain.txt
cat /root/domain/youtube/temp_youtube.yaml_* >> /root/domain/youtube/domain.txt

# 第二步:提取 DOMAIN 和 DOMAIN-SUFFIX 内容到 1.txt
grep -E "DOMAIN,|DOMAIN-SUFFIX," /root/domain/youtube/domain.txt | awk '{ if ($1 == "-") print $2; else print $3 }' | sed 's/^ *//;s/ *$//' > /root/domain/youtube/1.txt

# 第三步:从 1.txt 提取内容到 2.txt
awk -F',' '{print $2}' /root/domain/youtube/1.txt > /root/domain/youtube/2.txt

# 第四步:从 2.txt 去重并输出到 3.txt
awk '!seen[$0]++' /root/domain/youtube/2.txt > /root/domain/youtube/3.txt

# 删除临时文件
rm /root/domain/youtube/temp_youtube.yaml_*

echo "Success !!!"