From 3201d77a148367d739862b4f07868a76eaeb7cb1 Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sat, 13 Mar 2021 16:26:30 -0500 Subject: New upstream version 1.17.0. --- gallery_dl/extractor/500px.py | 16 +- gallery_dl/extractor/__init__.py | 11 +- gallery_dl/extractor/booru.py | 201 +--------------------- gallery_dl/extractor/common.py | 293 ++++++++++++++++++++------------ gallery_dl/extractor/cyberdrop.py | 58 +++++++ gallery_dl/extractor/deviantart.py | 10 +- gallery_dl/extractor/erome.py | 15 +- gallery_dl/extractor/exhentai.py | 116 ++++++++----- gallery_dl/extractor/foolfuuka.py | 232 ++++++++++++------------- gallery_dl/extractor/foolslide.py | 190 +++++++++++---------- gallery_dl/extractor/gelbooru.py | 14 +- gallery_dl/extractor/gelbooru_v01.py | 143 ++++++++++++++++ gallery_dl/extractor/gelbooru_v02.py | 194 +++++++++++++++++++++ gallery_dl/extractor/hentaicafe.py | 103 +++++++++-- gallery_dl/extractor/hentainexus.py | 10 +- gallery_dl/extractor/idolcomplex.py | 15 +- gallery_dl/extractor/imgur.py | 2 - gallery_dl/extractor/instagram.py | 144 +++++++++------- gallery_dl/extractor/komikcast.py | 2 +- gallery_dl/extractor/mangadex.py | 8 +- gallery_dl/extractor/mastodon.py | 216 ++++++++++------------- gallery_dl/extractor/message.py | 4 +- gallery_dl/extractor/moebooru.py | 245 +++++++++++++------------- gallery_dl/extractor/naverwebtoon.py | 128 ++++++++++++++ gallery_dl/extractor/oauth.py | 80 +++------ gallery_dl/extractor/patreon.py | 9 +- gallery_dl/extractor/pixiv.py | 5 +- gallery_dl/extractor/reactor.py | 23 +-- gallery_dl/extractor/readcomiconline.py | 5 +- gallery_dl/extractor/sankakucomplex.py | 11 +- gallery_dl/extractor/shopify.py | 79 ++++----- gallery_dl/extractor/tumblrgallery.py | 149 ++++++++++++++++ gallery_dl/extractor/twitter.py | 80 +++++++-- gallery_dl/extractor/unsplash.py | 6 +- gallery_dl/extractor/wallhaven.py | 146 +++++++++++----- 35 files changed, 1841 insertions(+), 1122 deletions(-) create mode 100644 gallery_dl/extractor/cyberdrop.py create mode 100644 gallery_dl/extractor/gelbooru_v01.py create mode 100644 gallery_dl/extractor/gelbooru_v02.py create mode 100644 gallery_dl/extractor/naverwebtoon.py create mode 100644 gallery_dl/extractor/tumblrgallery.py (limited to 'gallery_dl/extractor') diff --git a/gallery_dl/extractor/500px.py b/gallery_dl/extractor/500px.py index 81b11fd..aa0e8ad 100644 --- a/gallery_dl/extractor/500px.py +++ b/gallery_dl/extractor/500px.py @@ -50,6 +50,8 @@ class _500pxExtractor(Extractor): def _extend(self, edges): """Extend photos with additional metadata and higher resolution URLs""" + ids = [str(edge["node"]["legacyId"]) for edge in edges] + url = "https://api.500px.com/v1/photos" params = { "expanded_user_info" : "true", @@ -62,14 +64,14 @@ class _500pxExtractor(Extractor): "liked_by" : "1", "following_sample" : "100", "image_size" : "4096", - "ids" : ",".join( - str(edge["node"]["legacyId"]) for edge in edges), + "ids" : ",".join(ids), } - data = self._request_api(url, params)["photos"] + photos = self._request_api(url, params)["photos"] return [ - data[str(edge["node"]["legacyId"])] - for edge in edges + photos[pid] for pid in ids + if pid in photos or + self.log.warning("Unable to fetch photo %s", pid) ] def _request_api(self, url, params, csrf_token=None): @@ -142,6 +144,10 @@ class _500pxGalleryExtractor(_500pxExtractor): "user": dict, }, }), + # unavailable photos (#1335) + ("https://500px.com/p/Light_Expression_Photography/galleries/street", { + "count": 0, + }), ("https://500px.com/fashvamp/galleries/lera"), ) diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index 923a78b..57794d0 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -7,7 +7,6 @@ # published by the Free Software Foundation. import re -import importlib modules = [ "2chan", @@ -23,6 +22,7 @@ modules = [ "bcy", "behance", "blogger", + "cyberdrop", "danbooru", "derpibooru", "deviantart", @@ -35,6 +35,8 @@ modules = [ "furaffinity", "fuskator", "gelbooru", + "gelbooru_v01", + "gelbooru_v02", "gfycat", "hbrowse", "hentai2read", @@ -76,6 +78,7 @@ modules = [ "myhentaigallery", "myportfolio", "naver", + "naverwebtoon", "newgrounds", "ngomik", "nhentai", @@ -111,6 +114,7 @@ modules = [ "subscribestar", "tsumino", "tumblr", + "tumblrgallery", "twitter", "unsplash", "vanillarock", @@ -182,11 +186,12 @@ def _list_classes(): """Yield all available extractor classes""" yield from _cache + globals_ = globals() for module_name in _module_iter: - module = importlib.import_module("."+module_name, __package__) + module = __import__(module_name, globals_, None, (), 1) yield from add_module(module) - globals()["_list_classes"] = lambda : _cache + globals_["_list_classes"] = lambda : _cache def _get_classes(module): diff --git a/gallery_dl/extractor/booru.py b/gallery_dl/extractor/booru.py index 64cde80..c3cf3f7 100644 --- a/gallery_dl/extractor/booru.py +++ b/gallery_dl/extractor/booru.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Mike Fährmann +# Copyright 2015-2021 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 @@ -8,16 +8,12 @@ """Extractors for *booru sites""" -from .common import Extractor, Message, generate_extractors -from .. import text, util, exception - -from xml.etree import ElementTree -import collections +from .common import BaseExtractor, Message +from .. import text import operator -import re -class BooruExtractor(Extractor): +class BooruExtractor(BaseExtractor): """Base class for *booru extractors""" basecategory = "booru" filename_fmt = "{category}_{id}_{md5}.{extension}" @@ -66,191 +62,8 @@ class BooruExtractor(Extractor): _file_url = operator.itemgetter("file_url") - @staticmethod - def _prepare(post): - post["date"] = text.parse_datetime( - post["created_at"], "%a %b %d %H:%M:%S %z %Y") + def _prepare(self, post): + """Prepare the 'post's metadata""" def _extended_tags(self, post, page=None): - if not page: - url = "{}/index.php?page=post&s=view&id={}".format( - self.root, post["id"]) - page = self.request(url).text - html = text.extract(page, '