diff --git a/README.md b/README.md index 1c6b76e..ddd66ff 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ Flexget插件,增强对NexusPHP的过滤 过滤条件包括种子优惠信息(free等)、做种者情况、下载者情况 - `注意:本插件为测试版,未经过完全的测试` +- 开启二级验证将无法使用,自行斟酌取舍,未来版本将完善 - [站点支持列表](#site) ## 运行环境 @@ -128,3 +129,5 @@ pip3 install flexget # 使用pip3安装 3. 馒头 4. nice 5. 菠萝 +6. OurB***s +7. 天空 diff --git a/nexusphp.py b/nexusphp.py index 7007f8d..b4cab52 100644 --- a/nexusphp.py +++ b/nexusphp.py @@ -89,7 +89,10 @@ def consider_entry(_entry, _link): _entry.reject('%d is out of range of leecher' % len(leechers)) # 下载人数不匹配 return - max_complete = max(leechers, key=lambda x: x['completed'])['completed'] + if len(leechers) != 0: + max_complete = max(leechers, key=lambda x: x['completed'])['completed'] + else: + max_complete = 0 if max_complete > config['leechers']['max_complete']: _entry.reject('%f is more than max_complete' % max_complete) # 最大完成度不匹配 return @@ -107,7 +110,7 @@ def consider_entry(_entry, _link): for f in concurrent.futures.as_completed(futures): exception = f.exception() - if exception: + if isinstance(exception, plugin.PluginError): raise exception @staticmethod @@ -168,8 +171,14 @@ def get_peers(table): soup = get_soup(peer_page.content) tables = soup.find_all('table', limit=2) - seeders = get_peers(tables[0]) - leechers = get_peers(tables[1]) + try: + seeders = get_peers(tables[0]) + except IndexError: + seeders = [] + try: + leechers = get_peers(tables[1]) + except IndexError: + leechers = [] return discount, seeders, leechers @@ -177,6 +186,7 @@ def get_peers(table): def _get_info(task, link, cookie): headers = { 'cookie': cookie, + 'accept-encoding': 'gzip, deflate', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/75.0.3770.142 Safari/537.36' }