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