From 08d7934c6e40494819289874d2e00ad036b5efa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 17 Feb 2021 00:12:51 +0100 Subject: [PATCH] move extractors from booru.py into their own gelbooru_v02 module --- gallery_dl/extractor/__init__.py | 1 + gallery_dl/extractor/booru.py | 178 +------------------------ gallery_dl/extractor/gelbooru.py | 14 +- gallery_dl/extractor/gelbooru_v02.py | 186 +++++++++++++++++++++++++++ 4 files changed, 200 insertions(+), 179 deletions(-) create mode 100644 gallery_dl/extractor/gelbooru_v02.py diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index 923a78b3..f7ac1f0c 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -35,6 +35,7 @@ modules = [ "furaffinity", "fuskator", "gelbooru", + "gelbooru_v02", "gfycat", "hbrowse", "hentai2read", diff --git a/gallery_dl/extractor/booru.py b/gallery_dl/extractor/booru.py index 86d2aa04..c3cf3f72 100644 --- a/gallery_dl/extractor/booru.py +++ b/gallery_dl/extractor/booru.py @@ -9,12 +9,8 @@ """Extractors for *booru sites""" from .common import BaseExtractor, Message -from .. import text, util, exception - -from xml.etree import ElementTree -import collections +from .. import text import operator -import re class BooruExtractor(BaseExtractor): @@ -66,174 +62,8 @@ class BooruExtractor(BaseExtractor): _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, '