[pururin] update domain and fix extraction

This commit is contained in:
Mike Fährmann
2021-07-18 03:59:41 +02:00
parent b89a44090f
commit 3868ec02d1
2 changed files with 14 additions and 11 deletions

View File

@@ -285,7 +285,7 @@ Consider all sites to be NSFW unless otherwise known.
</tr> </tr>
<tr> <tr>
<td>Imagevenue</td> <td>Imagevenue</td>
<td>http://imagevenue.com/</td> <td>https://imagevenue.com/</td>
<td>individual Images</td> <td>individual Images</td>
<td></td> <td></td>
</tr> </tr>
@@ -597,7 +597,7 @@ Consider all sites to be NSFW unless otherwise known.
</tr> </tr>
<tr> <tr>
<td>Pururin</td> <td>Pururin</td>
<td>https://pururin.io/</td> <td>https://pururin.to/</td>
<td>Galleries</td> <td>Galleries</td>
<td></td> <td></td>
</tr> </tr>

View File

@@ -6,20 +6,22 @@
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation. # published by the Free Software Foundation.
"""Extractors for https://pururin.io/""" """Extractors for https://pururin.to/"""
from .common import GalleryExtractor from .common import GalleryExtractor
from .. import text, util from .. import text, util
import binascii
import json import json
class PururinGalleryExtractor(GalleryExtractor): class PururinGalleryExtractor(GalleryExtractor):
"""Extractor for image galleries on pururin.io""" """Extractor for image galleries on pururin.io"""
category = "pururin" category = "pururin"
pattern = r"(?:https?://)?(?:www\.)?pururin\.io/(?:gallery|read)/(\d+)" pattern = r"(?:https?://)?(?:www\.)?pururin\.[ti]o/(?:gallery|read)/(\d+)"
test = ( test = (
("https://pururin.io/gallery/38661/iowant-2", { ("https://pururin.to/gallery/38661/iowant-2", {
"pattern": r"https://cdn.pururin.io/\w+/images/data/\d+/\d+\.jpg", "pattern": r"https://cdn.pururin.[ti]o/\w+"
r"/images/data/\d+/\d+\.jpg",
"keyword": { "keyword": {
"title" : "re:I ?owant 2!!", "title" : "re:I ?owant 2!!",
"title_en" : "re:I ?owant 2!!", "title_en" : "re:I ?owant 2!!",
@@ -41,11 +43,12 @@ class PururinGalleryExtractor(GalleryExtractor):
"language" : "English", "language" : "English",
} }
}), }),
("https://pururin.io/gallery/7661/unisis-team-vanilla", { ("https://pururin.to/gallery/7661/unisis-team-vanilla", {
"count": 17, "count": 17,
}), }),
("https://pururin.io/gallery/38661/iowant-2"),
) )
root = "https://pururin.io" root = "https://pururin.to"
def __init__(self, match): def __init__(self, match):
self.gallery_id = match.group(1) self.gallery_id = match.group(1)
@@ -70,8 +73,8 @@ class PururinGalleryExtractor(GalleryExtractor):
url = "{}/read/{}/01/x".format(self.root, self.gallery_id) url = "{}/read/{}/01/x".format(self.root, self.gallery_id)
page = self.request(url).text page = self.request(url).text
info = json.loads(text.unescape(text.extract( info = json.loads(binascii.a2b_base64(text.extract(
page, ':gallery="', '"')[0])) page, '<gallery-read encoded="', '"')[0]).decode())
self._ext = info["image_extension"] self._ext = info["image_extension"]
self._cnt = info["total_pages"] self._cnt = info["total_pages"]
@@ -97,6 +100,6 @@ class PururinGalleryExtractor(GalleryExtractor):
return data return data
def images(self, _): def images(self, _):
ufmt = "https://cdn.pururin.io/assets/images/data/{}/{{}}.{}".format( ufmt = "https://cdn.pururin.to/assets/images/data/{}/{{}}.{}".format(
self.gallery_id, self._ext) self.gallery_id, self._ext)
return [(ufmt.format(num), None) for num in range(1, self._cnt + 1)] return [(ufmt.format(num), None) for num in range(1, self._cnt + 1)]