[imagevenue] improve error for dead images (#8477)
This commit is contained in:
@@ -174,7 +174,11 @@ class ImagevenueImageExtractor(ImagehostImageExtractor):
|
|||||||
example = "https://www.imagevenue.com/ME123456789"
|
example = "https://www.imagevenue.com/ME123456789"
|
||||||
|
|
||||||
def get_info(self, page):
|
def get_info(self, page):
|
||||||
pos = page.index('class="card-body')
|
try:
|
||||||
|
pos = page.index('class="card-body')
|
||||||
|
except ValueError:
|
||||||
|
raise exception.NotFoundError("image")
|
||||||
|
|
||||||
url, pos = text.extract(page, '<img src="', '"', pos)
|
url, pos = text.extract(page, '<img src="', '"', pos)
|
||||||
if url.endswith("/loader.svg"):
|
if url.endswith("/loader.svg"):
|
||||||
url, pos = text.extract(page, '<img src="', '"', pos)
|
url, pos = text.extract(page, '<img src="', '"', pos)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
# published by the Free Software Foundation.
|
# published by the Free Software Foundation.
|
||||||
|
|
||||||
from gallery_dl.extractor import imagehosts
|
from gallery_dl.extractor import imagehosts
|
||||||
|
from gallery_dl import exception
|
||||||
|
|
||||||
|
|
||||||
__tests__ = (
|
__tests__ = (
|
||||||
@@ -46,4 +47,12 @@ __tests__ = (
|
|||||||
"#sha1_content": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
|
"#sha1_content": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "http://img42.imagevenue.com/img.php?loc=loc1003%E2%84%91=20377_Alessandra_Ambrosio_Celebrity_City_Arriving_Mokai_Nightclub_17_13_1003lo.jpg",
|
||||||
|
"#comment" : "dead link / '404 Image Unavailable' redirect (#8477)",
|
||||||
|
"#category": ("imagehost", "imagevenue", "image"),
|
||||||
|
"#class" : imagehosts.ImagevenueImageExtractor,
|
||||||
|
"#exception": exception.NotFoundError,
|
||||||
|
},
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user