1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-25 12:12:34 +01:00

[bunkr] support 'bunkr:' URL prefix (#6017)

and support 'bunkr.ax' by default
This commit is contained in:
Mike Fährmann 2024-08-14 18:56:47 +02:00
parent 2d55521582
commit 0bbdeaaa50
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
4 changed files with 23 additions and 10 deletions

View File

@ -135,7 +135,7 @@ Consider all listed sites to potentially be NSFW.
</tr>
<tr>
<td>Bunkr</td>
<td>https://bunkr.sk/</td>
<td>https://bunkr.si/</td>
<td>Albums, Media Files</td>
<td></td>
</tr>

View File

@ -6,14 +6,15 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
"""Extractors for https://bunkr.sk/"""
"""Extractors for https://bunkr.si/"""
from .lolisafe import LolisafeAlbumExtractor
from .. import text
BASE_PATTERN = (
r"(?:bunkr:(?:https?://)?([^/?#]+)|"
r"(?:https?://)?(?:app\.)?(bunkr+"
r"\.(?:s[kiu]|[cf]i|ru|la|is|to|ac|black|cat|media|red|site|ws|org))"
r"\.(?:s[kiu]|[cf]i|ru|la|is|to|a[cx]|black|cat|media|red|site|ws|org)))"
)
LEGACY_DOMAINS = {
@ -28,15 +29,15 @@ LEGACY_DOMAINS = {
class BunkrAlbumExtractor(LolisafeAlbumExtractor):
"""Extractor for bunkr.sk albums"""
"""Extractor for bunkr.si albums"""
category = "bunkr"
root = "https://bunkr.sk"
root = "https://bunkr.si"
pattern = BASE_PATTERN + r"/a/([^/?#]+)"
example = "https://bunkr.sk/a/ID"
example = "https://bunkr.si/a/ID"
def __init__(self, match):
LolisafeAlbumExtractor.__init__(self, match)
domain = match.group(match.lastindex-1)
domain = self.groups[0] or self.groups[1]
if domain not in LEGACY_DOMAINS:
self.root = "https://" + domain
@ -83,11 +84,11 @@ class BunkrAlbumExtractor(LolisafeAlbumExtractor):
class BunkrMediaExtractor(BunkrAlbumExtractor):
"""Extractor for bunkr.sk media links"""
"""Extractor for bunkr.si media links"""
subcategory = "media"
directory_fmt = ("{category}",)
pattern = BASE_PATTERN + r"(/[vid]/[^/?#]+)"
example = "https://bunkr.sk/v/FILENAME"
example = "https://bunkr.si/v/FILENAME"
def fetch_album(self, album_id):
try:

View File

@ -34,7 +34,7 @@ class LolisafeAlbumExtractor(LolisafeExtractor):
def __init__(self, match):
LolisafeExtractor.__init__(self, match)
self.album_id = match.group(match.lastindex)
self.album_id = self.groups[-1]
def _init(self):
domain = self.config("domain")

View File

@ -57,6 +57,12 @@ __tests__ = (
"#count" : 9,
},
{
"#url" : "https://bunkr.ax/a/Lktg9Keq",
"#category": ("lolisafe", "bunkr", "album"),
"#class" : bunkr.BunkrAlbumExtractor,
},
{
"#url" : "https://bunkrrr.org/a/Lktg9Keq",
"#category": ("lolisafe", "bunkr", "album"),
@ -147,6 +153,12 @@ __tests__ = (
"#class" : bunkr.BunkrAlbumExtractor,
},
{
"#url" : "bunkr:http://example.org/a/Lktg9Keq",
"#category": ("lolisafe", "bunkr", "album"),
"#class" : bunkr.BunkrAlbumExtractor,
},
{
"#url" : "https://bunkr.black/i/image-sZrQUeOx.jpg",
"#category": ("lolisafe", "bunkr", "media"),