[imgdrive] add 'image' extractor (#7976)
This commit is contained in:
@@ -475,6 +475,12 @@ Consider all listed sites to potentially be NSFW.
|
|||||||
<td>individual Images</td>
|
<td>individual Images</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>ImgDrive.net</td>
|
||||||
|
<td>https://imgdrive.net/</td>
|
||||||
|
<td>individual Images</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Imgspice</td>
|
<td>Imgspice</td>
|
||||||
<td>https://imgspice.com/</td>
|
<td>https://imgspice.com/</td>
|
||||||
|
|||||||
@@ -396,3 +396,17 @@ class PicstateImageExtractor(ImagehostImageExtractor):
|
|||||||
url , pos = text.extract(page, '<img src="', '"', pos)
|
url , pos = text.extract(page, '<img src="', '"', pos)
|
||||||
filename, pos = text.extract(page, 'alt="', '"', pos)
|
filename, pos = text.extract(page, 'alt="', '"', pos)
|
||||||
return url, filename
|
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]
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ CATEGORY_MAP = {
|
|||||||
"imgbb" : "ImgBB",
|
"imgbb" : "ImgBB",
|
||||||
"imgbox" : "imgbox",
|
"imgbox" : "imgbox",
|
||||||
"imagechest" : "ImageChest",
|
"imagechest" : "ImageChest",
|
||||||
|
"imgdrive" : "ImgDrive.net",
|
||||||
"imgkiwi" : "IMG.Kiwi",
|
"imgkiwi" : "IMG.Kiwi",
|
||||||
"imgth" : "imgth",
|
"imgth" : "imgth",
|
||||||
"imgur" : "imgur",
|
"imgur" : "imgur",
|
||||||
|
|||||||
22
test/results/imgdrive.py
Normal file
22
test/results/imgdrive.py
Normal 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",
|
||||||
|
},
|
||||||
|
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user