-
Notifications
You must be signed in to change notification settings - Fork 117
config.yml
IvonWei edited this page Dec 13, 2024
·
8 revisions
更多配置可以学习Flexget官方文档
项目中 config_example.yml 是我当前正在使用的配置,仅供参考
web_server:
bind: 0.0.0.0
#web监听端口
port: 3539
#变量
variables:
headers:
user_agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36'
# "&" 设置锚点, "*" 引用锚点
via: &via_setting
- wechat_work:
corp_id: 'xxxxxxxx'
#小程序secret
corp_secret: 'xxxxxxxx'
agent_id: 'xxxxxxxx'
#用户id
to_user: 'xxxxxxxx'
# Telegram 配置参见 https://flexget.com/en/Plugins/Notifiers/telegram
- telegram:
bot_token: 'xxxxxxxx'
recipients:
# Chat ID 通过 @raw_data_bot (https://t.me/raw_data_bot) 获取
- chat_id: xxxxxxxx
socks_proxy: socks5://user:pass@host:port
sites: &sites_setting
# auto_sin_in 已适配网站(查看ptsites/sites下站点)
# 将 sites 配置在 variables 下,是无法在 webui 中获得自动补全的好处的。所以不熟悉的时候可以直接配置在 auto_sin_in / sites 之下
pt1: 'xxxxxxxxxxxxx'
pt2:
cookie: 'xxxxxxxxxxxxx'
pt3: 'xxxxxxxxxxxxx'
templates:
#从qBittorrent获取数据
from_qbittorrent_template:
from_qbittorrent_mod: &qbittorrent_setting
host: qbittorrent.example.com
port: 443
#非https请设置为 no
use_ssl: yes
username: xxxxxxxx
password: xxxxxxxx
#基础
qbittorrent_base_template:
qbittorrent_mod: *qbittorrent_setting
#添加
qbittorrent_add_template:
# 批量替换tracker
modify_trackers:
# 自定义属性名
- http2https:
# 查找 "http://"
from: http://
# 替换为 "http://"
to: https://
qbittorrent_mod:
action:
add:
#分类
category: Rss
#自动管理种子
autoTMM: yes
# 根据 trakcer 选择操作
tracker_options:
# 根据 trakcer 添加 tag
tag_by_tracker: yes
# 特定 traker 使用不同配置
specific_trackers:
# 覆盖 pt1 的 add 参数
- pt1:
# 覆盖上传限制
upLimit: 13107200
# 种子拒绝判断
reject_on:
#带宽
bandwidth_limit: 13107200
#当下载速度大于 bandwidth_limit * dl_speed 时 拒绝新种子
dl_speed: 0.6
#当限速低于 8MiB 时 拒绝新种子
dl_limit: 8388608
#设为yes可拒绝所有种子,一般清理数据库后使用防止添加未记录的老种
all: no
# 修改
qbittorrent_modify_template:
qbittorrent_mod:
action:
modify:
# 根据tracker添加种子标签
tag_by_tracker: yes
# 批量替换tracker
replace_trackers:
#http替换成https
'http://tracker.pt1.com/': 'https://tracker.pt1.com/'
#删除匹配到的tracker
'http://tracker6.pt1.com/': no
#恢复
qbittorrent_resume_template:
qbittorrent_mod:
action:
resume:
#如果保存路径上没有种子在正常做种,则重新校验种子,配合跳检,将种子还原成0进度状态
recheck_torrents: true
#连接数管理
qbittorrent_manage_conn_template:
qbittorrent_mod:
action:
#基于 当前连接数 + step 设置最大连接数,最小不低于 min, 最大不高于 max
manage_conn:
min: 100
max: 2000
# 根据tracker状态限制上传
qbittorrent_limit_upload_by_tracker_template:
qbittorrent_mod:
action:
limit_upload_by_tracker:
# 0为不限速,单位 byte
working: 0
not_working: 1
# 刷新 tracker 状态
qbittorrent_refresh_tracker_template:
qbittorrent_mod:
action:
refresh_tracker: yes
#删除
qbittorrent_delete_keeper_template:
qbittorrent_mod:
action:
remove:
keeper:
#array: 检查pt1,pt2的种子,全部满足删除条件则删除,包括辅种
check_reseed:
- pt1
- pt2
#删种同时数据
delete_files: true
#磁盘剩余空间小于 10 GiB时,才执行删除
keep_disk_space: 10
#删除成功后限制下载速度为 0 (不限速)
dl_limit_on_succeeded: 0
#删除成功后限制备用下载速度为 8 MiB
alt_dl_limit_on_succeeded: 8388608
#如执行任务后空间小于keep_disk_space,则自动限速为 (剩余空间 / dl_limit_interval) KiB/s, 不超过dl_limit_on_succeeded
#单位:秒
dl_limit_interval: 900
#清理
qbittorrent_delete_cleaner_template:
qbittorrent_mod:
action:
remove:
cleaner:
delete_files: yes
schedules:
- tasks: [ xxxx, xxxx, rss_download ]
interval:
#1分钟
minutes: 1
- tasks: [ reseed, resume, delete, modify, clean, refresh_tracker ]
interval:
minutes: 5
- tasks: [ xxxxx ]
interval:
minutes: 10
- tasks: [ sign_in, warner ]
schedule:
#8点到23点 每小时执行一次
hour: 8-23/1
#任务列表
tasks:
rss1:
#官方插件:rss 订阅链接
rss:
url: https://pt1.com/rss
#官方说这样会提高速度
all_entries: no
no_entries_ok: yes
#官方插件:regexp 过滤器 接受带有 CCTV 字样的种子
regexp:
accept:
- CCTV
from: title
#基础+添加种子(模板配置会自动合并)
template:
- qbittorrent_base_template
- qbittorrent_add_template
rss2:
# 相同过滤条件的rss可以放到一个inputs下
inputs:
- rss: https://pt1.com/rss
- rss: https://pt2.com/rss
#官方插件:accept_all 过滤器 接受全部
accept_all: yes
template:
- qbittorrent_base_template
- qbittorrent_add_template
pt3:
#网页获取下载数据 需要有css选择器知识 以下是打开碟片的置顶种子设置
html_rss:
url: https://pt3.com/torrents.php
user-agent: '{? headers.user_agent ?}'
cookie: '{? sites.pt3 ?}'
#以 "&" 开头时附加在下载链接之后,否则使用 urljoin 方式拼接
params: '&passkey=xxxxxxxxxxxxx'
#组件选择器
root_element_selector: '#form_torrent > table > tbody > tr.topdown_bg'
#以下配置基于上面 组件选择器 匹配到的组件做二次匹配
fields:
#标题(必选)
#为 entry 增加 title 属性 值为 匹配到的组件下的 title 属性
title:
#二次选择器
element_selector: 'a[href*="details.php"]'
#提取属性
attribute: title
#链接(必选)
#为 entry 增加 url 属性 值为 匹配到的组件下的 href 属性
url:
element_selector: 'a[href*="download.php"]'
attribute: href
#除title url属性为必选,其它可自由添加用于过滤
#示例 增加促销信息
#为 entry 增加 promotion 属性 值为 匹配到的组件下的 alt 属性
promotion:
element_selector: 'div[style="padding-bottom: 5px"] > img'
attribute: alt
no_entries_ok: yes
#如果promotion带有 Free则接受
if:
- promotion in ['Free']: accept
template:
- qbittorrent_base_template
- qbittorrent_add_template
#自动辅种 使用 IYUU 提供的接口
reseed:
#优先级 1
priority: 1
iyuu_auto_reseed:
# 设置种子来源
from:
from_qbittorrent_mod: *qbittorrent_setting
# 设置输出客户端类型
to: qbittorrent_mod
#IYUU token 获取方法请查阅顶部介绍的 IYUUAutoReseed 项目
token: xxxxxxxxxxxxxxxxxxxx
user-agent: '{? headers.user_agent ?}'
#站点密钥
passkeys:
#key: 站点域名包含字符串 value:密钥
#例 pt123.xyz
pt123: xxxxxxxxxxxxxxxxxxxx
# abc456.cn
abc456: xxxxxxxxxxxxxxxxxxxx
# pt3.edu.cn
pt3:
cookie: '{? sites.pt2.cookie ?}'
accept_all: yes
seen:
# 本地模式 只参考本任务的seen
local: yes
# 只拒绝相同 torrent_info_hash 的种子
fields:
- torrent_info_hash
qbittorrent_mod:
action:
add:
# 给辅种的种子打上 reseed 标签 (需预先手动添加一个 reseed 标签,截至 qb 4.3.5, qb使用不存在的tag作为add参数时,会导致webui出错)
tags: reseed
#跳过校验
skip_checking: yes
reject_on:
#忽略dl_speed 始终添加
dl_speed: no
#忽略dl_limit 始终添加
dl_limit: no
#忽略all 始终添加
all: no
template:
- qbittorrent_base_template
- qbittorrent_add_template
#自动开始
resume:
priority: 2
# 官方disable插件 禁用内置的记录 重试插件(禁用 history 可大幅度减小数据库占用空间)
disable: [ seen, seen_info_hash, retry_failed, history ]
if:
#选择进度100%、暂停状态、标记为 reseed 、1小时内(防止停止任务后又重新开始)添加的的种子
- qbittorrent_state == 'pausedUP' and 'reseed' in qbittorrent_tags and qbittorrent_added_on > now - timedelta(hours=1): accept
template:
- from_qbittorrent_template
- qbittorrent_base_template
- qbittorrent_resume_template
#自动删种
delete:
priority: 3
#官方插件:disable 关闭任务记录 失败重试
disable: [ seen, seen_info_hash, retry_failed, history ]
#官方插件: if 过滤器
if:
#参考entry属性列表
#种子在 Rss分类 并且 最后活动时间 > 2天
- qbittorrent_category in ['Rss'] and qbittorrent_last_activity < now - timedelta(days=2): accept
#当种子不属于 reseed 时,检测做种时间,防止hr
- "'reseed' not in qbittorrent_tags":
if:
#当 tags 带有 pt1 时,检测做种时间,小于48小时则拒绝
- "'pt1' in qbittorrent_tags and qbittorrent_seeding_time<48*60*60": reject
#官方sort_by插件:按最后活动时间从早到晚排序 优先删除
sort_by: qbittorrent_last_activity
template:
- from_qbittorrent_template
- qbittorrent_base_template
- qbittorrent_delete_keeper_template
#修改种子信息
modify:
priority: 4
disable: [ seen, seen_info_hash, retry_failed, history ]
accept_all: yes
template:
- from_qbittorrent_template
- qbittorrent_base_template
- qbittorrent_modify_template
#清理种子
clean:
priority: 5
disable: [ seen, seen_info_hash, retry_failed, history ]
if:
# 清理 标记为 reseed 且 未下载完 且 不在校验状态的种子
- "'reseed' in qbittorrent_tags and not qbittorrent_completed == qbittorrent_total_size and 'checking' not in qbittorrent_state": accept
# 清理 tracker 信息匹配的种子
regexp:
accept:
- '[Tt]orrent not registered with this tracker'
- 'Torrent banned'
- 'Unregistered torrent'
- '006-种子尚未上传或者已经被删除'
- 'Torrent is not authorized for use on this tracker.'
from: qbittorrent_tracker_msg
template:
- from_qbittorrent_template
- qbittorrent_base_template
- qbittorrent_delete_cleaner_template
#连接数管理
manage_conn:
disable: [ seen, seen_info_hash, retry_failed, history ]
from_qbittorrent_mod:
server_state: yes
accept_all: yes
if:
#当IO任务队列小于 20 时,设置step为 +50
- 'server_state["queued_io_jobs"] < 20':
set:
step: 50
#当IO任务队列大于 80 时,设置step为 -100
- 'server_state["queued_io_jobs"] > 80':
set:
step: -100
template:
- from_qbittorrent_template
- qbittorrent_base_template
- qbittorrent_manage_conn_template
#- show_entry_template
# 防白嫖
limit_upload_by_tracker:
disable: [ seen, seen_info_hash, retry_failed, history ]
if:
# 筛选 不在暂停状态 且 添加时间大于 5分钟 的种子
- "'paused' not in qbittorrent_state and qbittorrent_added_on < now - timedelta(minutes=5)": accept
from_qbittorrent_mod:
# 强制重新获取 正在上传的种子的 trakcer 状态
force_update: uploading
template:
- from_qbittorrent_template
- qbittorrent_base_template
- qbittorrent_limit_upload_by_tracker_template
# 刷新 tracker 状态
refresh_tracker:
disable: [ seen, seen_info_hash, retry_failed, history ]
if:
# 刷选限速为 1 的种子
- qbittorrent_up_limit == 1:
regexp:
accept:
# 刷新 tracker_msg 为以下值的 tracker 状态(通过两次修改重新连接trakcer服务器)
- 'skipping tracker announce \(unreachable\)'
- 'unsupported URL protocol'
from: qbittorrent_tracker_msg
template:
- from_qbittorrent_template
- qbittorrent_base_template
- qbittorrent_refresh_tracker_template
#自动签到
sign_in:
auto_sign_in:
user-agent: '{? headers.user_agent ?}'
#baidu ocr参数
aipocr:
app_id: 'xxxxxxxxx'
api_key: 'xxxxxxxxx'
secret_key: 'xxxxxxxxx'
#默认所有站点都获取未读消息
sites: *sites_setting
accept_all: yes
retry_failed:
retry_time_multiplier: no
seen:
fields:
- title
notify:
task:
# 保证失败消息发送
always_send: true
message: |+
{%- if task.accepted -%}
{%- for group in task.accepted|groupby('task') -%}
FlexGet has just signed in {{ group.list|length }} sites for task {{ group.grouper }}:
{% for entry in group.list %}
{{ loop.index }}: {{ entry.title }} {{ entry.result }}
{%- if entry.messages|d('') %}
Messages: {{ entry.messages }}
{% endif %}
{%- endfor -%}
{%- endfor -%}
{%- endif -%}
{%- if task.failed %}
{% for group in task.failed|groupby('task') %}
The following sites have failed for task {{ group.grouper }}:
{% for entry in group.list %}
{{ loop.index }}: {{ entry.title }} Reason: {{ entry.reason|d('unknown') }}
{%- if entry.messages|d('') %}
Messages: {{ entry.messages }}
{% endif %}
{%- endfor -%}
{%- endfor -%}
{%- endif -%}
via:
- wechat_work:
corp_id: 'xxxxxxxxxxxxx'
corp_secret: 'xxxxxxxxxxxxxxx'
agent_id: 'xxxxxxxxxxxxxxxx'
to_user: 'xxxxxxxxxxxxxxx'
#发送统计图片
image: 'details_report.png'
- telegram_mod:
bot_token: xxxxxxxxxxx
#发送统计图片
image: 'details_report.png'
recipients:
- username: 'xxxxxxxxxxx'
#服务器状态预警
warner:
disable: [ seen, seen_info_hash, retry_failed, history ]
from_qbittorrent_mod:
# 生成带 server_state 的唯一entry, 并设置 title 为 'qBittorrent Server State'
server_state: 'qBittorrent Server State'
if:
# qBittorrent 不可连接
- 'not server_state["flexget_connected"]': accept
# 下载速度 < 1 MiB
- 'server_state["dl_info_speed"] < 1048576': accept
# 上传速度 < 1 MiB
- 'server_state["up_info_speed"] < 1048576': accept
# 磁盘剩余空间< 5 GiB
- 'server_state["free_space_on_disk"] < 5368709120': accept
template:
- from_qbittorrent_template
notify:
entries:
message: |+
{{ time }}
{{ title }}:
{% if not server_state.flexget_connected -%}
flexget_connected: False
{%- else -%}
dl_info_speed: {{(server_state['dl_info_speed']/1024/1024)|int}} MiB
up_info_speed: {{(server_state['up_info_speed']/1024/1024)|int}} MiB
free_space_on_disk: {{(server_state['free_space_on_disk']/1024/1024/1024)|int}} GiB
{% endif %}
via: *via_setting
#种子转移
transfer:
disable: [ seen, seen_info_hash, retry_failed, history ]
from_qbittorrent_mod:
host: qbittorrent2.example.com
port: 443
use_ssl: yes
username: xxxxxxxx
password: xxxxxxxx
regexp:
accept:
# gazellegames 分类
- gazellegames:
set:
# file:/BT_backup/ 路径为被转移qbittorrent的BT_backup
# doker映射例子:/docker/qbittorrent2/config/data/qBittorrent/BT_backup/:/BT_backup
url: 'file:/BT_backup/{{torrent_info_hash}}.torrent'
#设置分类为被转移分类,需要手动先创建分类并指定路径
category: '{{qbittorrent_category}}'
from: qbittorrent_category
qbittorrent_mod:
host: qbittorrent1.example.com
port: 443
use_ssl: yes
username: xxxxxxxx
password: xxxxxxxx
action:
add:
skip_checking: yes
reject_on:
dl_speed: no
dl_limit: no
all: no
show_entry:
state: accepted
attribute:
- url