[silverpic] add 'image' extractor (#8020)

This commit is contained in:
Mike Fährmann
2025-08-13 09:16:03 +02:00
parent c6f8a99c75
commit 8581b3f7c5
4 changed files with 54 additions and 0 deletions

View File

@@ -949,6 +949,12 @@ Consider all listed sites to potentially be NSFW.
<td>Boards, Likes, Pins, User Pins, related Pins, Search Results</td>
<td></td>
</tr>
<tr>
<td>SilverPic.com</td>
<td>https://silverpic.com/</td>
<td>individual Images</td>
<td></td>
</tr>
<tr>
<td>Simply Hentai</td>
<td>https://www.simply-hentai.com/</td>

View File

@@ -426,3 +426,26 @@ class ImgtaxiImageExtractor(ImagehostImageExtractor):
example = "https://imgtaxi.com/img-0123456789abc.html"
get_info = ImgdriveImageExtractor.get_info
class SilverpicImageExtractor(ImagehostImageExtractor):
"""Extractor for single images from silverpic.com"""
category = "silverpic"
pattern = (r"(?:https?://)?((?:www\.)?silverpic\.com"
r"/([a-z0-9]{10,})/[\S]+\.html)")
example = "https://silverpic.com/a1b2c3d4f5g6/NAME.EXT.html"
def get_info(self, page):
url, pos = text.extract(page, '<img src="/img/', '"')
alt, pos = text.extract(page, 'alt="', '"', pos)
return "https://silverpic.com/img/" + url, alt
def metadata(self, page):
pos = page.find('<img src="/img/')
width = text.extract(page, 'width="', '"', pos)[0]
height = text.extract(page, 'height="', '"', pos)[0]
return {
"width" : text.parse_int(width),
"height": text.parse_int(height),
}

View File

@@ -148,6 +148,7 @@ CATEGORY_MAP = {
"senmanga" : "Sen Manga",
"sensescans" : "Sense-Scans",
"sexcom" : "Sex.com",
"silverpic" : "SilverPic.com",
"simplyhentai" : "Simply Hentai",
"slickpic" : "SlickPic",
"slideshare" : "SlideShare",

24
test/results/silverpic.py Normal file
View File

@@ -0,0 +1,24 @@
# -*- 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://www.silverpic.com/8k562jyix8xq/jxU_0001.JPG.html",
"#category": ("imagehost", "silverpic", "image"),
"#class" : imagehosts.SilverpicImageExtractor,
"#results" : "https://silverpic.com/img/z7esmp7eor37ssodt4ptpxbzoy/jxU_0001.JPG",
"filename" : "jxU_0001",
"extension": "jpg",
"token" : "8k562jyix8xq",
"width" : 3744,
"height" : 5616,
},
)