[picstate] add 'image' extractor (#7946)

This commit is contained in:
Marcus Minhorst
2025-08-01 01:48:00 -04:00
committed by GitHub
parent 952fcb1b8b
commit 65fbd3972d
3 changed files with 53 additions and 0 deletions

View File

@@ -733,6 +733,12 @@ Consider all listed sites to potentially be NSFW.
<td>Galleries</td>
<td></td>
</tr>
<tr>
<td>Picstate</td>
<td>https://picstate.com/</td>
<td>individual Images</td>
<td></td>
</tr>
<tr>
<td>Pictoa</td>
<td>https://pictoa.com/</td>

View File

@@ -383,3 +383,16 @@ class FappicImageExtractor(ImagehostImageExtractor):
filename = filename[13:]
return url, filename
class PicstateImageExtractor(ImagehostImageExtractor):
"""Extractor for single images from picstate.com"""
category = "picstate"
pattern = r"(?:https?://)?((?:www\.)?picstate\.com/view/full/([^/?#]+))"
example = "https://picstate.com/view/full/123"
def get_info(self, page):
pos = page.index(' id="image_container"')
url , pos = text.extract(page, '<img src="', '"', pos)
filename, pos = text.extract(page, 'alt="', '"', pos)
return url, filename

34
test/results/picstate.py Normal file
View File

@@ -0,0 +1,34 @@
# -*- 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://picstate.com/view/full/23416694_sfyue",
"#class" : imagehosts.PicstateImageExtractor,
"#results" : "https://picstate.com/file/23416694_sfyue/test-___-_22__.png",
"#sha1_content" : "0c8768055e4e20e7c7259608b67799171b691140",
"filename" : "test-___-_22__",
"extension" : "png",
"token" : "23416694_sfyue",
},
{
"#url" : "https://picstate.com/view/full/21812181_qxtpb",
"#class" : imagehosts.PicstateImageExtractor,
"#results" : "https://picstate.com/files/21812181_qxtpb/0.jpg",
"#sha1_content" : "bbb2b257049633f450660c88b75813c8c39612b1",
"#sha1_metadata": "68f331e95977d71cd7d615f259359ef3bbb8f163",
"filename" : "0",
"extension" : "jpg",
"token" : "21812181_qxtpb",
},
)