fix spider

This commit is contained in:
jxxghp 2023-07-08 08:15:55 +08:00
parent ee87c64bc9
commit c17e64b509

View File

@ -610,17 +610,16 @@ class TorrentSpider:
@staticmethod @staticmethod
def __index(items, selector): def __index(items, selector):
if not selector:
return items[0] if isinstance(items, list) else items
if not items: if not items:
return items return items
if "contents" in selector \ if selector:
and len(items) > int(selector.get("contents")): if "contents" in selector \
items = items[0].split("\n")[selector.get("contents")] and len(items) > int(selector.get("contents")):
elif "index" in selector \ items = items[0].split("\n")[selector.get("contents")]
and len(items) > int(selector.get("index")): elif "index" in selector \
items = items[int(selector.get("index"))] and len(items) > int(selector.get("index")):
elif isinstance(items, list): items = items[int(selector.get("index"))]
if isinstance(items, list):
items = items[0] items = items[0]
return items return items