7

折腾4T只需5欧的Seedbox – 含FlexGet

 3 years ago
source link: https://www.taterli.com/7630/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

折腾4T只需5欧的Seedbox – 含FlexGet

最近发现一个叫Pulsed Media的Seedbox卖家,主要销售下面配置的Seedbox,据说限量50份,这年头都喜欢饥饿营销嘛?另外这个最多最多买6个月.

磁盘大小:4TB / 6TB
可用内存:3GB / 6GB
端口速度:1Gbps / 1Gbps
流量限制:20TB / 无限制
价格:4.99 EUR / 6.99 EUR
支持软件:rTorrent + Deluge (特别注意,使用的软件是ruTorrent界面,所以部分API不兼容.)
访问协议:HTTP, HTTPS, FTP, SFTP, LFTP, SSH
预装软件:sonarr, pyload, flexget, rclone, resilio, syncthing, btsync (1.4 and 2.2), ffmpeg, fuse
退款保证:14 天
额外奖励:自动额外磁盘奖励
购买连接:4TB款(自动应用优惠) 6TB款(自动应用优惠)

有多猛我自己试了一下.

为了能更愉快地玩,虽然有flexget,但是要一分钟订阅,抢不到第一排位置很不爽啊,我就自己写了个程序,自动暴力加种删种,提供给大家一个参考.(PS:流量更新不及时!)

import datetime
import json
import urllib.parse

import feedparser
import pymongo
import requests

client = pymongo.MongoClient("mongodb+srv://xxxx:[email protected]/default")
mongodb = client.torrent


class QBAgent:
    def __init__(self, auth):
        self.auth = auth
        pass

    # 返回True则可以考虑添加种子,返回False则不能添加种子.
    def check(self):
        headers = {
            'Authorization': self.auth
        }

        response = requests.get("http://3-97hakuna.pulsedmedia.com/user-xxxx/rutorrent/plugins/hddquota/action.php",
                                headers=headers)

        disk_total = int(json.loads(response.text)['total']) / 1024 / 1024 / 1024
        disk_free = int(json.loads(response.text)['free']) / 1024 / 1024 / 1024

        payload = 'mode=list&cmd=d.throttle_name%3D&cmd=d.custom%3Dchk-state&cmd=d.custom%3Dchk-time&cmd=d.custom%3Dsch_ignore&cmd=cat%3D%22%24t.multicall%3Dd.hash%3D%2Ct.scrape_complete%3D%2Ccat%3D%7B%23%7D%22&cmd=cat%3D%22%24t.multicall%3Dd.hash%3D%2Ct.scrape_incomplete%3D%2Ccat%3D%7B%23%7D%22&cmd=d.custom%3Dx-pushbullet&cmd=cat%3D%24d.views%3D&cmd=d.custom%3Dseedingtime&cmd=d.custom%3Daddtime'
        response = requests.post("http://3-97hakuna.pulsedmedia.com/user-xxxx/rutorrent/plugins/httprpc/action.php",
                                 headers=headers, data=payload)

        ts = json.loads(response.text)
        ul_total = 0.0
        dl_total = 0.0
        task_free = disk_total
        for t in ts['t']:
            torrent_hash = t
            torrent_name = ts['t'][t][4]
            torrent_size = int(ts['t'][t][5]) / 1024 / 1024 / 1024

            completed_chunks = ts['t'][t][6]
            hashed_chunks = ts['t'][t][24]
            size_chunks = ts['t'][t][7]
            if int(ts['t'][t][1]) == 0:
                chunks_processing = completed_chunks
            else:
                chunks_processing = hashed_chunks
            torrent_processing = int(chunks_processing) / int(size_chunks)

            downloaded = int(ts['t'][t][8]) / 1024 / 1024 / 1024
            uploaded = int(ts['t'][t][9]) / 1024 / 1024 / 1024
            ul = int(ts['t'][t][11]) / 1024 / 1024
            dl = int(ts['t'][t][12]) / 1024 / 1024

            ul_total = ul + ul_total
            dl_total = dl + dl_total
            task_free = task_free - torrent_size
            self.disk_free = disk_free

            created = ts['t'][t][26]

            # torrent_hash => 种子Hash
            # torrent_name => 种子名
            # torrent_size => 种子大小
            # torrent_processing => 完成百分比
            # downloaded => 已下载大小(GB)
            # uploaded => 已上传大小(GB)
            # ul => 上传速度(MB)
            # dl => 下载速度(MB)
            # created => 创建的时间戳

            # print([torrent_hash, torrent_name, torrent_size, torrent_processing, downloaded, uploaded, ul, dl, created])

        response = requests.get("http://3-97hakuna.pulsedmedia.com/user-xxxx/welcome.php", headers=headers)
        bw = response.text.split('<td id="meter-disk-td" title="')[1].split('">')[0].replace('GiB', ' GB')

        print("当前磁盘空间余量 %.2f GB[%.2f GB],流量使用 %s,上传速度 %.2f MB/s,下载速度 %.2f MB/s." % (
            task_free, disk_free, bw, ul_total, dl_total
        ))

        if disk_free < 10:
            return False

        return True

    # 尝试进行清理
    def clean(self):
        deleted = False
        headers = {
            'Authorization': self.auth
        }

        response = requests.get("http://3-97hakuna.pulsedmedia.com/user-xxxx/rutorrent/plugins/hddquota/action.php",
                                headers=headers)

        disk_free = int(json.loads(response.text)['free']) / 1024 / 1024 / 1024

        # 实际剩余空间如果小于10G.
        if disk_free > 10:
            print('无清理的必要性.')
            return deleted

        payload = 'mode=list&cmd=d.throttle_name%3D&cmd=d.custom%3Dchk-state&cmd=d.custom%3Dchk-time&cmd=d.custom%3Dsch_ignore&cmd=cat%3D%22%24t.multicall%3Dd.hash%3D%2Ct.scrape_complete%3D%2Ccat%3D%7B%23%7D%22&cmd=cat%3D%22%24t.multicall%3Dd.hash%3D%2Ct.scrape_incomplete%3D%2Ccat%3D%7B%23%7D%22&cmd=d.custom%3Dx-pushbullet&cmd=cat%3D%24d.views%3D&cmd=d.custom%3Dseedingtime&cmd=d.custom%3Daddtime'
        response = requests.post("http://3-97hakuna.pulsedmedia.com/user-xxxx/rutorrent/plugins/httprpc/action.php",
                                 headers=headers, data=payload)

        ts = json.loads(response.text)
        for t in ts['t']:
            completed_chunks = ts['t'][t][6]
            hashed_chunks = ts['t'][t][24]
            size_chunks = ts['t'][t][7]
            if int(ts['t'][t][1]) == 0:
                chunks_processing = completed_chunks
            else:
                chunks_processing = hashed_chunks
            torrent_processing = int(chunks_processing) / int(size_chunks)

            ul = int(ts['t'][t][11]) / 1024 / 1024
            dl = int(ts['t'][t][12]) / 1024 / 1024

            if (ul + dl) < 1024 and torrent_processing == 1.0:
                cursor = mongodb['agent'].find_one({"torrent_hash": t})
                if cursor is not None:
                    print('[主程序]标记完成:' + cursor['title'])
                    mongodb['agent'].update_one({"torrent_hash": t}, {"$set": {
                        "finished": True
                    }})

                    payload = '<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>system.multicall</methodName><params><param><value><array><data><value><struct><member><name>methodName</name><value><string>d.custom5.set</string></value></member><member><name>params</name><value><array><data><value><string>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</string></value><value><string>1</string></value></data></array></value></member></struct></value><value><struct><member><name>methodName</name><value><string>d.delete_tied</string></value></member><member><name>params</name><value><array><data><value><string>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</string></value></data></array></value></member></struct></value><value><struct><member><name>methodName</name><value><string>d.erase</string></value></member><member><name>params</name><value><array><data><value><string>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</string></value></data></array></value></member></struct></value></data></array></value></param></params></methodCall>'

                    requests.post("http://3-97hakuna.pulsedmedia.com/user-xxxx/rutorrent/plugins/httprpc/action.php",
                                  headers=headers, data=payload.replace('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
                                                                        t))

                deleted = True

        return deleted

    # 种子添加
    def add(self, urls):
        c = urllib.parse.quote_plus(urls)
        url = "http://3-97hakuna.pulsedmedia.com/user-xxxx/rutorrent/php/addtorrent.php?dir_edit=/home/xxxx/data/&url=" + c

        headers = {
            'Authorization': 'Basic bmlja2ZveDphMWEzZTFvUU0x',
            'Content-Type': 'application/x-www-form-urlencoded'
        }

        requests.get(url, headers=headers, verify=False)

        return True


r = QBAgent('Basic xxxx')
r.check()

while True:
    # 抓取所有种子
    torrents = feedparser.parse(
        'https://lemonhd.org/torrentrss.php?rows=10&linktype=dl&passkey=xxxx')['entries']
    r.check()
    for torrent in torrents:
        cursor = mongodb['agent'].find_one({'torrent_hash': torrent['id']})
        # 如果种子没在数据库,可以考虑添加.
        if cursor is None:
            added = False
            if r.check() is True:
                if r.add(torrent['links'][1]['href']) is True:
                    mongodb['agent'].insert_one({
                        "title": torrent['title'],
                        "torrent_hash": torrent['id'],
                        "torrent_announce": "http://announce.leaguehd.com/announce.php?passkey=xxxx",
                        "create_time": datetime.datetime.now(),
                        "finished": False
                    })
                else:
                    r.clean()

如果觉得麻烦,用Flexget一样很爽哦,网上很多教程怎么用FlexGet订阅PT站.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK