You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gallery-dl/gallery_dl/extractor/gelbooru.py

35 lines
1.0 KiB

# -*- coding: utf-8 -*-
10 years ago
# 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):
10 years ago
def __init__(self, match):
XMLBooruExtractor.__init__(self, match, info)
self.api_url = "http://gelbooru.com/"
self.params = {"page":"dapi", "s":"post", "q":"index", "tags":self.tags}
10 years ago
def update_page(self, reset=False):
if reset is False:
self.params["pid"] += 1
else:
self.params["pid"] = 0