From 5cb46a2cb3ffed3c62741c3da0186168bec289d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 11 Apr 2015 00:17:43 +0200 Subject: [PATCH] [gelbooru] update to new extractor interface --- gallery_dl/extractor/gelbooru.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/gallery_dl/extractor/gelbooru.py b/gallery_dl/extractor/gelbooru.py index 43a9ffcd..824b5c47 100644 --- a/gallery_dl/extractor/gelbooru.py +++ b/gallery_dl/extractor/gelbooru.py @@ -1,10 +1,29 @@ -from .danbooru import XMLBooruExtractor +# -*- coding: utf-8 -*- -class Extractor(XMLBooruExtractor): +# Copyright 2014, 2015 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 image-urls from http://gelbooru.com/""" + +from .booru import XMLBooruExtractor + +info = { + "category": "gelbooru", + "extractor": "GelbooruExtractor", + "directory": ["{category}", "{tags}"], + "filename": "{category}_{name}", + "pattern": [ + r"(?:https?://)?(?:www\.)?gelbooru\.com/(?:index\.php)?\?page=post&s=list&tags=([^&]+).*", + ], +} + +class GelbooruExtractor(XMLBooruExtractor): def __init__(self, match, config): - XMLBooruExtractor.__init__(self, match, config) - self.category = "gelbooru" + XMLBooruExtractor.__init__(self, match, config, info) self.api_url = "http://gelbooru.com/" self.params = {"page":"dapi", "s":"post", "q":"index", "tags":self.tags}