[pornreactor] add tag-, user-, post-extractors (#114)
This commit is contained in:
@@ -70,6 +70,7 @@ modules = [
|
|||||||
"piczel",
|
"piczel",
|
||||||
"pinterest",
|
"pinterest",
|
||||||
"pixiv",
|
"pixiv",
|
||||||
|
"pornreactor",
|
||||||
"powermanga",
|
"powermanga",
|
||||||
"readcomiconline",
|
"readcomiconline",
|
||||||
"rebeccablacktech",
|
"rebeccablacktech",
|
||||||
|
|||||||
@@ -6,13 +6,16 @@
|
|||||||
# 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 http://joyreactor.com/"""
|
"""Extractors for http://joyreactor.cc/"""
|
||||||
|
|
||||||
from .common import Extractor, Message
|
from .common import Extractor, Message
|
||||||
from .. import text
|
from .. import text
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
BASE_PATTERN = r"(?:https?://)?(?:www\.)?(joyreactor\.c(?:c|om))"
|
||||||
|
|
||||||
|
|
||||||
class JoyreactorExtractor(Extractor):
|
class JoyreactorExtractor(Extractor):
|
||||||
"""Base class for joyreactor extractors"""
|
"""Base class for joyreactor extractors"""
|
||||||
category = "joyreactor"
|
category = "joyreactor"
|
||||||
@@ -23,7 +26,7 @@ class JoyreactorExtractor(Extractor):
|
|||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
Extractor.__init__(self)
|
Extractor.__init__(self)
|
||||||
self.url = match.group(0)
|
self.url = match.group(0)
|
||||||
self.root = "http://joyreactor." + match.group(1)
|
self.root = "http://" + match.group(1)
|
||||||
self.session.headers["Referer"] = self.root
|
self.session.headers["Referer"] = self.root
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
@@ -112,11 +115,11 @@ class JoyreactorExtractor(Extractor):
|
|||||||
|
|
||||||
|
|
||||||
class JoyreactorTagExtractor(JoyreactorExtractor):
|
class JoyreactorTagExtractor(JoyreactorExtractor):
|
||||||
"""Extractor for tag searches on joyreactor.com"""
|
"""Extractor for tag searches on joyreactor.cc"""
|
||||||
subcategory = "tag"
|
subcategory = "tag"
|
||||||
directory_fmt = ["{category}", "{search_tags}"]
|
directory_fmt = ["{category}", "{search_tags}"]
|
||||||
archive_fmt = "{search_tags}_{post_id}_{num}"
|
archive_fmt = "{search_tags}_{post_id}_{num}"
|
||||||
pattern = [r"(?:https?://)?(?:www\.)?joyreactor\.(com|cc)/tag/([^/?&#]+)"]
|
pattern = [BASE_PATTERN + r"/tag/([^/?&#]+)"]
|
||||||
test = [
|
test = [
|
||||||
("http://joyreactor.com/tag/Cirno", {
|
("http://joyreactor.com/tag/Cirno", {
|
||||||
"url": "a81382a3146da50b647c475f87427a6ca1d737df",
|
"url": "a81382a3146da50b647c475f87427a6ca1d737df",
|
||||||
@@ -137,10 +140,10 @@ class JoyreactorTagExtractor(JoyreactorExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class JoyreactorUserExtractor(JoyreactorExtractor):
|
class JoyreactorUserExtractor(JoyreactorExtractor):
|
||||||
"""Extractor for all posts of a user on joyreactor.com"""
|
"""Extractor for all posts of a user on joyreactor.cc"""
|
||||||
subcategory = "user"
|
subcategory = "user"
|
||||||
directory_fmt = ["{category}", "user", "{user}"]
|
directory_fmt = ["{category}", "user", "{user}"]
|
||||||
pattern = [r"(?:https?://)?(?:www\.)?joyreactor\.(com|cc)/user/([^/?&#]+)"]
|
pattern = [BASE_PATTERN + r"/user/([^/?&#]+)"]
|
||||||
test = [
|
test = [
|
||||||
("http://joyreactor.com/user/Tacoman123", {
|
("http://joyreactor.com/user/Tacoman123", {
|
||||||
"url": "0444158f17c22f08515ad4e7abf69ad2f3a63b35",
|
"url": "0444158f17c22f08515ad4e7abf69ad2f3a63b35",
|
||||||
@@ -161,9 +164,9 @@ class JoyreactorUserExtractor(JoyreactorExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class JoyreactorPostExtractor(JoyreactorExtractor):
|
class JoyreactorPostExtractor(JoyreactorExtractor):
|
||||||
"""Extractor for single posts on joyreactor.com"""
|
"""Extractor for single posts on joyreactor.cc"""
|
||||||
subcategory = "post"
|
subcategory = "post"
|
||||||
pattern = [r"(?:https?://)?(?:www\.)?joyreactor\.(com|cc)/post/(\d+)"]
|
pattern = [BASE_PATTERN + r"/post/(\d+)"]
|
||||||
test = [
|
test = [
|
||||||
("http://joyreactor.com/post/3721876", { # single image
|
("http://joyreactor.com/post/3721876", { # single image
|
||||||
"url": "904779f6571436f3d5adbce30c2c272f6401e14a",
|
"url": "904779f6571436f3d5adbce30c2c272f6401e14a",
|
||||||
|
|||||||
61
gallery_dl/extractor/pornreactor.py
Normal file
61
gallery_dl/extractor/pornreactor.py
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
# -*- 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.
|
||||||
|
|
||||||
|
"""Extractors for http://pornreactor.cc/"""
|
||||||
|
|
||||||
|
from .joyreactor import (
|
||||||
|
JoyreactorTagExtractor,
|
||||||
|
JoyreactorUserExtractor,
|
||||||
|
JoyreactorPostExtractor,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
BASE_PATTERN = r"(?:https?://)?(?:www\.)?(pornreactor\.cc|fapreactor.com)"
|
||||||
|
|
||||||
|
|
||||||
|
class PornreactorTagExtractor(JoyreactorTagExtractor):
|
||||||
|
"""Extractor for tag searches on pornreactor.cc"""
|
||||||
|
category = "pornreactor"
|
||||||
|
pattern = [BASE_PATTERN + r"/tag/([^/?&#]+)"]
|
||||||
|
test = [
|
||||||
|
("http://pornreactor.cc/tag/RiceGnat", {
|
||||||
|
"count": ">= 120",
|
||||||
|
}),
|
||||||
|
("http://fapreactor.com/tag/RiceGnat", None),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class PornreactorUserExtractor(JoyreactorUserExtractor):
|
||||||
|
"""Extractor for all posts of a user on pornreactor.cc"""
|
||||||
|
category = "pornreactor"
|
||||||
|
pattern = [BASE_PATTERN + r"/user/([^/?&#]+)"]
|
||||||
|
test = [
|
||||||
|
("http://pornreactor.cc/user/Disillusion", {
|
||||||
|
"url": "7e06f87f8dcce3fc7851b6d13aa55712ab45fb04",
|
||||||
|
"keyword": "edfefb54ea4863e3731c508ae6caeb4140be0d31",
|
||||||
|
}),
|
||||||
|
("http://fapreactor.com/user/Disillusion", None),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class PornreactorPostExtractor(JoyreactorPostExtractor):
|
||||||
|
"""Extractor for single posts on pornreactor.cc"""
|
||||||
|
category = "pornreactor"
|
||||||
|
subcategory = "post"
|
||||||
|
pattern = [BASE_PATTERN + r"/post/(\d+)"]
|
||||||
|
test = [
|
||||||
|
("http://pornreactor.cc/post/863166", {
|
||||||
|
"url": "9e5f7b374605cbbd413f4f4babb9d1af6f95b843",
|
||||||
|
"keyword": "6e9e4bd4e2d4f3f2c7936340ec71f8693129f809",
|
||||||
|
"content": "3e2a09f8b5e5ed7722f51c5f423ff4c9260fb23e",
|
||||||
|
}),
|
||||||
|
("http://fapreactor.com/post/863166", {
|
||||||
|
"url": "83ff7c87741c05bcf1de6825e2b4739afeb87ed5",
|
||||||
|
"keyword": "cf8159224fde59c1dab86677514b4aedeb533d66",
|
||||||
|
}),
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user