[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

@@ -475,6 +475,12 @@ Consider all listed sites to potentially be NSFW.
<td>individual Images</td>
<td></td>
</tr>
<tr>
<td>ImgDrive.net</td>
<td>https://imgdrive.net/</td>
<td>individual Images</td>
<td></td>
</tr>
<tr>
<td>Imgspice</td>
<td>https://imgspice.com/</td>

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]

View File

@@ -84,6 +84,7 @@ CATEGORY_MAP = {
"imgbb" : "ImgBB",
"imgbox" : "imgbox",
"imagechest" : "ImageChest",
"imgdrive" : "ImgDrive.net",
"imgkiwi" : "IMG.Kiwi",
"imgth" : "imgth",
"imgur" : "imgur",

22
test/results/imgdrive.py Normal file
View File

@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
from gallery_dl.extractor import imagehosts
__tests__ = (
{
"#url" : "https://imgdrive.net/img-61ac0caeabf35.html",
"#category": ("imagehost", "imgdrive", "image"),
"#class" : imagehosts.ImgdriveImageExtractor,
"#results" : "https://imgdrive.net/images/big/2021/12/05/61ac0caeabf33.JPG",
"extension": "jpg",
"filename" : "5yl_0001",
"token" : "61ac0caeabf35",
},
)