lala.im:自动下载PT站的最新FREE种

運維技術·lala.im · 2019-07-10 · 111 人浏览

原文地址:https://lala.im/6006.html,請支持原作者!該處僅作轉載。

RSS订阅下载是刷子们普遍用的一种方式,但这种方法最明显的弊端就是无法选择性的下载种子,如果我能够选择只下载FREE种,那刷出来的数据岂不是更漂亮?所以现在有人就写了这么一个py脚本,可以实现这个功能啦:
https://tieba.baidu.com/p/6123226674\nhttps://github.com/cshenxi/ptscripts
系统以Debian9为例,安装pip3/依赖:

apt -y install git python3-pip
pip3 install bs4 requests lxml

拉取文件:

mkdir -p /opt/freetorrent/torrent && cd /opt/freetorrent
git clone https://github.com/cshenxi/ptscripts.git
cd ptscripts

给执行权限:

chmod +x download_free_PTtorrents_v3_debug.py

编辑:

nano download_free_PTtorrents_v3_debug.py

在这个文件最上方加入一行:

#!/usr/bin/python3

然后要改动的地方,这里我以M-TEAM为例:

site_name = "M-TEAM"
site_url = "https://tp.m-team.cc/torrents.php"
site_cookie = "c_lang; tp=你的cookies" # 注意M-Team的cookies前面必须要有c_lang,否则无法登录成功
url_half = "https://tp.m-team.cc/"
monitor_path = r'/opt/freetorrent/torrent/'
user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'
referer = 'https://tp.m-team.cc/login.php'
host = 'tp.m-team.cc'

cookie/useragent如何获取?打开Chrome,登录你的M-Team账号,然后按F12:

範例
添加计划任务:

crontab -e

每两个小时执行一次:

0 */2 * * * /usr/bin/python3 /opt/freetorrent/ptscripts/download_free_PTtorrents_v3_debug.py

为验证是否可以正常下载,这里我们最好先自己手动运行一遍:

./download_free_PTtorrents_v3_debug.py

如果正常,你将看到类似这样的回显:

範例
然后在qBittorrent上设置监控文件夹:

範例
然后我可以看到QB在正常下载了:

範例
并且下载的全部都是FREE种:

範例

運維技術 BT lala.im
Theme Jasmine by Kent Liao