[sxypix] add support (#4507 #8391 #8574)

* Add support for sxypix.com
* update & simplify
    - text.extract -> text.extr
    - self.request().json() -> self.request_json()
    - use self.groups
    - remove __init__
    - list comprehension
* update test results

---------

Co-authored-by: Mike Fährmann <mike_faehrmann@web.de>
This commit is contained in:
MyFinalBellyache
2025-11-19 14:30:29 +05:00
committed by GitHub
parent 991fe0f2a7
commit 157a37b053
4 changed files with 71 additions and 0 deletions

View File

@@ -1009,6 +1009,12 @@ Consider all listed sites to potentially be NSFW.
<td>Posts, User Profiles</td>
<td>Supported</td>
</tr>
<tr id="sxypix" title="sxypix">
<td>Sxypix</td>
<td>https://sxypix.com/</td>
<td>Galleries</td>
<td></td>
</tr>
<tr id="tapas" title="tapas">
<td>Tapas</td>
<td>https://tapas.io/</td>

View File

@@ -192,6 +192,7 @@ modules = [
"speakerdeck",
"steamgriddb",
"subscribestar",
"sxypix",
"szurubooru",
"tapas",
"tcbscans",

View File

@@ -0,0 +1,39 @@
# -*- 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.
"""Extractors for https://sxypix.com/"""
from .common import GalleryExtractor
from .. import text
class SxypixGalleryExtractor(GalleryExtractor):
"""Extractor for image galleries from sxypix.com"""
category = "sxypix"
root = "https://sxypix.com"
pattern = r"(?:https?://)?(?:www\.)?sxypix\.com(/w/(\w+))"
example = "https://sxypix.com/w/2bbaf1b24a5863d0e73436619bbaa7ee"
def metadata(self, page):
return {
"gallery_id": self.groups[1],
"title": text.unescape(text.extr(
page, '<meta name="keywords" content="', '"')),
}
def images(self, page):
data = {
"aid" : text.extr(page, "data-aid='", "'"),
"ghash": text.extr(page, "data-ghash='", "'"),
}
gallery = self.request_json(
"https://sxypix.com/php/gall.php", method="POST", data=data)
base = "https://x."
return [
(base + text.extr(entry, "data-src='//.", "'"), None)
for entry in gallery["r"]
]

25
test/results/sxypix.py Normal file
View File

@@ -0,0 +1,25 @@
# -*- 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 sxypix
__tests__ = (
{
"#url" : "https://sxypix.com/w/c42ec529474789f812dd8ba26103855f",
"#category": ("", "sxypix", "gallery"),
"#class" : sxypix.SxypixGalleryExtractor,
"#count" : 35,
"count" : 35,
"num" : range(1, 35),
"filename" : "hash:md5",
"extension" : "webp",
"gallery_id": "c42ec529474789f812dd8ba26103855f",
"title" : "#MommysBoy - Penny Barber - Coddling Her Boy",
},
)