Skip to content

Commit

Permalink
[nijie] add 'include' option (closes #1018)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Sep 25, 2020
1 parent 0d43456 commit 6514312
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
15 changes: 15 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,21 @@ Description A (comma-separated) list of subcategories to include
=========== =====


extractor.nijie.include
----------------------------
=========== =====
Type ``string`` or ``list`` of ``strings``
Default ``"illustration,doujin"``
Description A (comma-separated) list of subcategories to include
when processing a user profile.

Possible values are
``"illustration"``, ``"doujin"``, ``"favorite"``.

You can use ``"all"`` instead of listing all values separately.
=========== =====


extractor.oauth.browser
-----------------------
=========== =====
Expand Down
23 changes: 19 additions & 4 deletions gallery_dl/extractor/nijie.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright 2015-2019 Mike Fährmann
# Copyright 2015-2020 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
Expand Down Expand Up @@ -127,9 +127,25 @@ def _pagination(self, path):


class NijieUserExtractor(NijieExtractor):
"""Extractor for works of a nijie-user"""
"""Extractor for nijie user profiles"""
subcategory = "user"
pattern = BASE_PATTERN + r"/members(?:_illust)?\.php\?id=(\d+)"
cookiedomain = None
pattern = BASE_PATTERN + r"/members\.php\?id=(\d+)"
test = ("https://nijie.info/members.php?id=44",)

def items(self):
base = "{}/{{}}.php?id={}".format(self.root, self.user_id)
return self._dispatch_extractors((
(NijieIllustrationExtractor, base.format("members_illust")),
(NijieDoujinExtractor , base.format("members_dojin")),
(NijieFavoriteExtractor , base.format("user_like_illust_view")),
), ("illustration", "doujin"))


class NijieIllustrationExtractor(NijieExtractor):
"""Extractor for all illustrations of a nijie-user"""
subcategory = "illustration"
pattern = BASE_PATTERN + r"/members_illust\.php\?id=(\d+)"
test = (
("https://nijie.info/members_illust.php?id=44", {
"url": "66c4ff94c6e77c0765dd88f2d8c663055fda573e",
Expand All @@ -152,7 +168,6 @@ class NijieUserExtractor(NijieExtractor):
("https://nijie.info/members_illust.php?id=43", {
"exception": exception.NotFoundError,
}),
("https://nijie.info/members.php?id=44"),
)

def image_ids(self):
Expand Down

0 comments on commit 6514312

Please sign in to comment.