[idolcomplex] add support for idol.sankakucomplex.com
This commit is contained in:
@@ -37,6 +37,7 @@ modules = [
|
||||
"hentaifoundry",
|
||||
"hentaihere",
|
||||
"hitomi",
|
||||
"idolcomplex",
|
||||
"imagebam",
|
||||
"imagefap",
|
||||
"imgbox",
|
||||
|
||||
@@ -299,7 +299,7 @@ class DeviantartCollectionExtractor(DeviantartExtractor):
|
||||
test = [(("https://pencilshadings.deviantart.com"
|
||||
"/favourites/70595441/3D-Favorites"), {
|
||||
"url": "742f92199d5bc6a89cda6ec6133d46c7a523824d",
|
||||
"keyword": "22aa30e064cf8cd8b9ca7944f4877f5ac9793cfa",
|
||||
"keyword": "9210c976b5274eff6ea1d2b8a4f891c9f35ce340",
|
||||
"options": (("original", False),),
|
||||
})]
|
||||
|
||||
|
||||
48
gallery_dl/extractor/idolcomplex.py
Normal file
48
gallery_dl/extractor/idolcomplex.py
Normal file
@@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Mike Fährmann
|
||||
#
|
||||
# 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.
|
||||
|
||||
"""Extract images from https://idol.sankakucomplex.com/"""
|
||||
|
||||
from . import sankaku
|
||||
|
||||
|
||||
class IdolcomplexExtractor(sankaku.SankakuExtractor):
|
||||
"""Base class for idolcomplex extractors"""
|
||||
category = "idolcomplex"
|
||||
subdomain = "idol"
|
||||
|
||||
|
||||
class IdolcomplexTagExtractor(IdolcomplexExtractor,
|
||||
sankaku.SankakuTagExtractor):
|
||||
"""Extractor for images from idol.sankakucomplex.com by search-tags"""
|
||||
pattern = [r"(?:https?://)?idol\.sankakucomplex\.com"
|
||||
r"/\?(?:[^&#]*&)*tags=([^&#]+)"]
|
||||
test = [("https://idol.sankakucomplex.com/?tags=lyumos+wreath", {
|
||||
"count": ">= 6",
|
||||
"pattern": (r"https://is\.sankakucomplex\.com/data/[^/]{2}/[^/]{2}"
|
||||
r"/[^/]{32}\.\w+\?e=\d+&m=[^&#]+"),
|
||||
})]
|
||||
|
||||
|
||||
class IdolcomplexPoolExtractor(IdolcomplexExtractor,
|
||||
sankaku.SankakuPoolExtractor):
|
||||
"""Extractor for image-pools from idol.sankakucomplex.com"""
|
||||
pattern = [r"(?:https?://)?idol\.sankakucomplex\.com/pool/show/(\d+)"]
|
||||
test = [("https://idol.sankakucomplex.com/pool/show/145", {
|
||||
"count": 3,
|
||||
})]
|
||||
|
||||
|
||||
class IdolcomplexPostExtractor(IdolcomplexExtractor,
|
||||
sankaku.SankakuPostExtractor):
|
||||
"""Extractor for single images from idol.sankakucomplex.com"""
|
||||
pattern = [r"(?:https?://)?idol\.sankakucomplex\.com/post/show/(\d+)"]
|
||||
test = [("https://idol.sankakucomplex.com/post/show/694215", {
|
||||
"content": "694ec2491240787d75bf5d0c75d0082b53a85afd",
|
||||
"count": 1,
|
||||
})]
|
||||
@@ -20,12 +20,14 @@ class SankakuExtractor(SharedConfigExtractor):
|
||||
basecategory = "booru"
|
||||
category = "sankaku"
|
||||
filename_fmt = "{category}_{id}_{md5}.{extension}"
|
||||
root = "https://chan.sankakucomplex.com"
|
||||
cookienames = ("login", "pass_hash")
|
||||
cookiedomain = "chan.sankakucomplex.com"
|
||||
subdomain = "chan"
|
||||
|
||||
def __init__(self):
|
||||
SharedConfigExtractor.__init__(self)
|
||||
self.cookiedomain = self.subdomain + ".sankakucomplex.com"
|
||||
self.root = "https://" + self.cookiedomain
|
||||
|
||||
self.logged_in = True
|
||||
self.start_page = 1
|
||||
self.start_post = 0
|
||||
@@ -61,7 +63,7 @@ class SankakuExtractor(SharedConfigExtractor):
|
||||
url = self.root + "/post/show/" + post_id
|
||||
page = self.request(url, retries=10).text
|
||||
|
||||
tags , pos = extr(page, "<title>", " | Sankaku Channel</title>")
|
||||
tags , pos = extr(page, "<title>", " | ")
|
||||
vavg , pos = extr(page, "itemprop=ratingValue>", "<", pos)
|
||||
vcnt , pos = extr(page, "itemprop=reviewCount>", "<", pos)
|
||||
_ , pos = extr(page, "Posted: <", "", pos)
|
||||
@@ -100,7 +102,7 @@ class SankakuExtractor(SharedConfigExtractor):
|
||||
return
|
||||
username, password = self._get_auth_info()
|
||||
if username:
|
||||
cookies = self._login_impl(username, password)
|
||||
cookies = self._login_impl((username, self.subdomain), password)
|
||||
for key, value in cookies.items():
|
||||
self.session.cookies.set(
|
||||
key, value, domain=self.cookiedomain)
|
||||
@@ -108,8 +110,9 @@ class SankakuExtractor(SharedConfigExtractor):
|
||||
self.logged_in = False
|
||||
|
||||
@cache(maxage=90*24*60*60, keyarg=1)
|
||||
def _login_impl(self, username, password):
|
||||
def _login_impl(self, usertuple, password):
|
||||
"""Actual login implementation"""
|
||||
username = usertuple[0]
|
||||
self.log.info("Logging in as %s", username)
|
||||
params = {
|
||||
"url": "",
|
||||
|
||||
Reference in New Issue
Block a user