diff --git a/gallery_dl/extractor/realbooru.py b/gallery_dl/extractor/realbooru.py index 6648d024..6d89151e 100644 --- a/gallery_dl/extractor/realbooru.py +++ b/gallery_dl/extractor/realbooru.py @@ -1,21 +1,19 @@ # -*- coding: utf-8 -*- -# Copyright 2014-2019 Mike Fährmann +# Copyright 2019 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://realbooru.com/""" +"""Extractors for https://realbooru.com/""" from . import booru -from .common import Message -from .. import text, util class RealbooruExtractor(booru.XmlParserMixin, - booru.GelbooruPageMixin, - booru.BooruExtractor): + booru.GelbooruPageMixin, + booru.BooruExtractor): """Base class for realbooru extractors""" category = "realbooru" api_url = "https://realbooru.com/index.php" @@ -24,108 +22,38 @@ class RealbooruExtractor(booru.XmlParserMixin, def __init__(self, match): super().__init__(match) - - self.use_api = self.config("api", True) - if self.use_api: - self.params.update({"page": "dapi", "s": "post", "q": "index"}) - else: - self.items = self.items_noapi - self.session.cookies["fringeBenefits"] = "yup" - - def items_noapi(self): - yield Message.Version, 1 - data = self.get_metadata() - - for post in self.get_posts(): - post = self.get_post_data(post) - url = post["file_url"] - post.update(data) - text.nameext_from_url(url, post) - yield Message.Directory, post - yield Message.Url, url, post - - def get_posts(self): - """Return an iterable containing all relevant post objects""" - - def get_post_data(self, post_id): - """Extract metadata of a single post""" - page = self.request(self.post_url.format(post_id)).text - data = text.extract_all(page, ( - (None , 'Id: ', '<'), - ("created_at", '