[safebooru] add extractor
This commit is contained in:
parent
6772b54bc4
commit
8469b3ae4f
@ -33,6 +33,7 @@ modules = [
|
||||
"nijie",
|
||||
"powermanga",
|
||||
"redhawkscans",
|
||||
"safebooru",
|
||||
"yandere",
|
||||
]
|
||||
|
||||
|
34
gallery_dl/extractor/safebooru.py
Normal file
34
gallery_dl/extractor/safebooru.py
Normal file
@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# 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://safebooru.org/"""
|
||||
|
||||
from .booru import XMLBooruExtractor
|
||||
|
||||
info = {
|
||||
"category": "safebooru",
|
||||
"extractor": "SafebooruExtractor",
|
||||
"directory": ["{category}", "{tags}"],
|
||||
"filename": "{category}_{name}",
|
||||
"pattern": [
|
||||
r"(?:https?://)?(?:www\.)?safebooru\.org/(?:index\.php)?\?page=post&s=list&tags=([^&]+).*",
|
||||
],
|
||||
}
|
||||
|
||||
class SafebooruExtractor(XMLBooruExtractor):
|
||||
|
||||
def __init__(self, match):
|
||||
XMLBooruExtractor.__init__(self, match, info)
|
||||
self.api_url = "http://safebooru.org/index.php"
|
||||
self.params = {"page":"dapi", "s":"post", "q":"index", "tags":self.tags}
|
||||
|
||||
def update_page(self, reset=False):
|
||||
if reset is False:
|
||||
self.params["pid"] += 1
|
||||
else:
|
||||
self.params["pid"] = 0
|
Loading…
x
Reference in New Issue
Block a user