madwind / flexget_qbittorrent_mod

flexget qbittorrent删种、辅种 自动签到 插件
MIT License
552 stars 117 forks source link

m-team no get login #12

Closed luyiming closed 3 years ago

luyiming commented 3 years ago

为啥馒头不支持 cookie 访问了,现在我看必须要用户名密码登录,但是如果开启二级验证的话,登陆访问一定会触发验证码。我试了下 cookie 访问在开启二级验证的情况下还是可以用的。

luyiming commented 3 years ago

下面这段代码就可以的

from ..schema.nexusphp import NexusPHP
from ..schema.site_base import SignState, Work
from ..utils.net_utils import NetUtils

class MainClass(NexusPHP):
    URL = 'https://kp.m-team.cc/'
    USER_CLASSES = {
        'downloaded': [2147483648000, 3221225472000],
        'share_ratio': [7, 9],
        'days': [168, 224]
    }

    def build_workflow(self, entry, config):
        return [
            Work(
                url='/index.php',
                method='get',
                succeed_regex='歡迎回來',
                fail_regex=None,
                check_state=('final', SignState.SUCCEED),
                is_base_content=True
            )
        ]

    def build_selector(self):
        selector = super(MainClass, self).build_selector()
        NetUtils.dict_merge(selector, {
            'details': {
                'hr': None
            }
        })
        return selector

    def get_message(self, entry, config):
        self.get_nexusphp_message(entry, config)
        system_message_url = '/messages.php?action=viewmailbox&box=-2'
        self.get_nexusphp_message(entry, config, messages_url=system_message_url)
madwind commented 3 years ago

因为mt容易触发登陆 ip ua变化 都有可能触发,总的来说就是 cookie 不持久,如果你不想开二级,可以不配置,会跳过的。当然也可以像比如 ob 一样优先cookie,不过感觉意义不大,除非特殊时期关闭登陆

luyiming commented 3 years ago

发现了,我换到 seedbox 上,cookie 就失效了,确实麻烦