[imgdrive] add 'image' extractor (#7976)

This commit is contained in:
Mike Fährmann
2025-08-05 19:50:06 +02:00
parent ca44b6e338
commit ef8044f546
4 changed files with 43 additions and 0 deletions

View File

@@ -396,3 +396,17 @@ class PicstateImageExtractor(ImagehostImageExtractor):
url , pos = text.extract(page, '<img src="', '"', pos)
filename, pos = text.extract(page, 'alt="', '"', pos)
return url, filename
class ImgdriveImageExtractor(ImagehostImageExtractor):
"""Extractor for single images from imgdrive.net"""
category = "imgdrive"
pattern = r"(?:https?://)?((?:www\.)?imgdrive\.net/img-(\w+)\.html)"
example = "https://imgdrive.net/img-0123456789abc.html"
def get_info(self, page):
title, pos = text.extract(
page, 'property="og:title" content="', '"')
url , pos = text.extract(
page, 'property="og:image" content="', '"', pos)
return url.replace("/small/", "/big/"), title.rsplit(" | ", 2)[0]