32 lines
1.1 KiB
Python
Raw Normal View History

2015-11-06 13:24:43 +01:00
# -*- coding: utf-8 -*-
# Copyright 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 https://konachan.com/"""
2015-11-21 02:09:02 +01:00
from . import booru
2015-11-06 13:24:43 +01:00
2015-11-21 02:09:02 +01:00
class KonachanExtractor(booru.JSONBooruExtractor):
"""Base class for konachan extractors"""
category = "konachan"
api_url = "https://konachan.com/post.json"
2015-11-06 13:24:43 +01:00
2015-11-21 02:09:02 +01:00
class KonachanTagExtractor(KonachanExtractor, booru.BooruTagExtractor):
"""Extract images from konachan based on search-tags"""
2015-11-30 01:11:13 +01:00
subcategory = "tag"
2015-11-21 02:09:02 +01:00
pattern = [r"(?:https?://)?(?:www\.)?konachan\.com/post\?tags=([^&]+)"]
2015-11-06 13:24:43 +01:00
2015-11-21 02:09:02 +01:00
class KonachanPoolExtractor(KonachanExtractor, booru.BooruPoolExtractor):
"""Extract image-pools from konachan"""
2015-11-30 01:11:13 +01:00
subcategory = "pool"
2015-11-21 02:09:02 +01:00
pattern = [r"(?:https?://)?(?:www\.)?konachan\.com/pool/show/(\d+)"]
class KonachanPostExtractor(KonachanExtractor, booru.BooruPostExtractor):
"""Extract single images from konachan"""
2015-11-30 01:11:13 +01:00
subcategory = "post"
2015-11-21 02:09:02 +01:00
pattern = [r"(?:https?://)?(?:www\.)?konachan\.com/post/show/(\d+)"]