系统:MACOS
浏览器:EDGE
运行方式:全自动化,指定时间,自动打开预设好的PT站地址,全部任务执行完毕后,自动关闭浏览器。
1:使用脚本编辑器添加脚本:visit_sites_edge.scpt (站点可以自行编辑),我放在:文稿 文件夹
-- visit_sites_edge.scpt
set urls to {¬
"https://hhanclub.top/torrents.php", ¬
"https://ptchdbits.co/torrents.php?cat=401", ¬
"https://next.m-team.cc/index", ¬
"https://hdsky.my/index.php", ¬
"https://pterclub.net", ¬
"https://springsunday.net/index.php", ¬
"https://www.hddolby.com/index.php", ¬
"https://totheglory.im/browse.php?c=M", ¬
"https://hdhome.org/index.php", ¬
"https://pt.keepfrds.com/index.php", ¬
"https://ourbits.club", ¬
"https://audiences.me", ¬
}
-- 逐个打开网址(使用 open location,无需权限)
repeat with theURL in urls
do shell script "open -a 'Microsoft Edge' " & quoted form of theURL
delay 10
end repeat
-- ⚠️ 关键:10 秒后强制退出 Edge(确保所有页面加载完成)
delay 5
do shell script "killall 'Microsoft Edge' 2>/dev/null || true"
2:创建plist
# 删除旧文件(如有) rm ~/Library/LaunchAgents/com.user.visit_sites_edge.plist # 用 nano 创建新文件 nano ~/Library/LaunchAgents/com.user.visit_sites_edge.plist
然后严格粘贴以下内容(这是经过验证的合法 XML):
注意:路径,填写自己的电脑名字、时间默认是每周3的5点,自行修改
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.visit_sites_edge</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/osascript</string>
<string>/Users/你的名字/Documents/visit_sites_edge.scpt</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Weekday</key>
<integer>3</integer>
<key>Hour</key>
<integer>5</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
<key>RunAtLoad</key>
<false/>
</dict>
</plist>
保存方法:
Control + O→ 回车确认Control + X→ 退出
3:检查文件权限
ls -l ~/Library/LaunchAgents/com.user.visit_sites_edge.plist
正常应显示类似:-rw-r--r--@ 1 dingli staff 600 Oct 27 10:10 ...
如果不是,修复权限
chmod 644 ~/Library/LaunchAgents/com.user.visit_sites_edge.plist chown dingli:staff ~/Library/LaunchAgents/com.user.visit_sites_edge.plist
4:再次加载
launchctl unload ~/Library/LaunchAgents/com.user.visit_sites_edge.plist 2>/dev/null launchctl load ~/Library/LaunchAgents/com.user.visit_sites_edge.plist
5:验证是否成功
launchctl list | grep visit