Skip to content

Commit 157a37b

Browse files
[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 <[email protected]>
1 parent 991fe0f commit 157a37b

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

docs/supportedsites.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,12 @@ Consider all listed sites to potentially be NSFW.
10091009
<td>Posts, User Profiles</td>
10101010
<td>Supported</td>
10111011
</tr>
1012+
<tr id="sxypix" title="sxypix">
1013+
<td>Sxypix</td>
1014+
<td>https://sxypix.com/</td>
1015+
<td>Galleries</td>
1016+
<td></td>
1017+
</tr>
10121018
<tr id="tapas" title="tapas">
10131019
<td>Tapas</td>
10141020
<td>https://tapas.io/</td>

gallery_dl/extractor/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@
192192
"speakerdeck",
193193
"steamgriddb",
194194
"subscribestar",
195+
"sxypix",
195196
"szurubooru",
196197
"tapas",
197198
"tcbscans",

gallery_dl/extractor/sxypix.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# This program is free software; you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License version 2 as
5+
# published by the Free Software Foundation.
6+
7+
"""Extractors for https://sxypix.com/"""
8+
9+
from .common import GalleryExtractor
10+
from .. import text
11+
12+
13+
class SxypixGalleryExtractor(GalleryExtractor):
14+
"""Extractor for image galleries from sxypix.com"""
15+
category = "sxypix"
16+
root = "https://sxypix.com"
17+
pattern = r"(?:https?://)?(?:www\.)?sxypix\.com(/w/(\w+))"
18+
example = "https://sxypix.com/w/2bbaf1b24a5863d0e73436619bbaa7ee"
19+
20+
def metadata(self, page):
21+
return {
22+
"gallery_id": self.groups[1],
23+
"title": text.unescape(text.extr(
24+
page, '<meta name="keywords" content="', '"')),
25+
}
26+
27+
def images(self, page):
28+
data = {
29+
"aid" : text.extr(page, "data-aid='", "'"),
30+
"ghash": text.extr(page, "data-ghash='", "'"),
31+
}
32+
gallery = self.request_json(
33+
"https://sxypix.com/php/gall.php", method="POST", data=data)
34+
35+
base = "https://x."
36+
return [
37+
(base + text.extr(entry, "data-src='//.", "'"), None)
38+
for entry in gallery["r"]
39+
]

test/results/sxypix.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# This program is free software; you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License version 2 as
5+
# published by the Free Software Foundation.
6+
7+
from gallery_dl.extractor import sxypix
8+
9+
10+
__tests__ = (
11+
{
12+
"#url" : "https://sxypix.com/w/c42ec529474789f812dd8ba26103855f",
13+
"#category": ("", "sxypix", "gallery"),
14+
"#class" : sxypix.SxypixGalleryExtractor,
15+
"#count" : 35,
16+
17+
"count" : 35,
18+
"num" : range(1, 35),
19+
"filename" : "hash:md5",
20+
"extension" : "webp",
21+
"gallery_id": "c42ec529474789f812dd8ba26103855f",
22+
"title" : "#MommysBoy - Penny Barber - Coddling Her Boy",
23+
},
24+
25+
)

0 commit comments

Comments
 (0)