fix spider
This commit is contained in:
parent
ee87c64bc9
commit
c17e64b509
@ -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 selector:
|
||||||
if "contents" in selector \
|
if "contents" in selector \
|
||||||
and len(items) > int(selector.get("contents")):
|
and len(items) > int(selector.get("contents")):
|
||||||
items = items[0].split("\n")[selector.get("contents")]
|
items = items[0].split("\n")[selector.get("contents")]
|
||||||
elif "index" in selector \
|
elif "index" in selector \
|
||||||
and len(items) > int(selector.get("index")):
|
and len(items) > int(selector.get("index")):
|
||||||
items = items[int(selector.get("index"))]
|
items = items[int(selector.get("index"))]
|
||||||
elif isinstance(items, list):
|
if isinstance(items, list):
|
||||||
items = items[0]
|
items = items[0]
|
||||||
return items
|
return items
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user