use str startswith()

This commit is contained in:
lededev
2021-06-06 05:14:13 +08:00
parent ac22fcdf05
commit 9072f8b5ec

View File

@@ -48,7 +48,7 @@ def getCover(htmlcode): #获取封面链接
doc = pq(htmlcode) doc = pq(htmlcode)
image = doc('a.bigImage') image = doc('a.bigImage')
uri = image.attr('href') uri = image.attr('href')
if uri[0:4] == 'http': if uri.startswith('http'):
return uri return uri
if uri[0] != '/': if uri[0] != '/':
uri = '/' + uri uri = '/' + uri