mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
[imgur] match gallery/album/image URLs with title slugs (#5593)
This commit is contained in:
parent
07d962d60a
commit
7f1ed909d5
@ -68,7 +68,7 @@ class ImgurImageExtractor(ImgurExtractor):
|
||||
filename_fmt = "{category}_{id}{title:?_//}.{extension}"
|
||||
archive_fmt = "{id}"
|
||||
pattern = (BASE_PATTERN + r"/(?!gallery|search)"
|
||||
r"(?:r/\w+/)?(\w{7}|\w{5})[sbtmlh]?")
|
||||
r"(?:r/\w+/)?(?:[^/?#]+-)?(\w{7}|\w{5})[sbtmlh]?")
|
||||
example = "https://imgur.com/abcdefg"
|
||||
|
||||
def items(self):
|
||||
@ -93,7 +93,7 @@ class ImgurAlbumExtractor(ImgurExtractor):
|
||||
directory_fmt = ("{category}", "{album[id]}{album[title]:? - //}")
|
||||
filename_fmt = "{category}_{album[id]}_{num:>03}_{id}.{extension}"
|
||||
archive_fmt = "{album[id]}_{id}"
|
||||
pattern = BASE_PATTERN + r"/a/(\w{7}|\w{5})"
|
||||
pattern = BASE_PATTERN + r"/a/(?:[^/?#]+-)?(\w{7}|\w{5})"
|
||||
example = "https://imgur.com/a/abcde"
|
||||
|
||||
def items(self):
|
||||
@ -126,7 +126,7 @@ class ImgurAlbumExtractor(ImgurExtractor):
|
||||
class ImgurGalleryExtractor(ImgurExtractor):
|
||||
"""Extractor for imgur galleries"""
|
||||
subcategory = "gallery"
|
||||
pattern = BASE_PATTERN + r"/(?:gallery|t/\w+)/(\w{7}|\w{5})"
|
||||
pattern = BASE_PATTERN + r"/(?:gallery|t/\w+)/(?:[^/?#]+-)?(\w{7}|\w{5})"
|
||||
example = "https://imgur.com/gallery/abcde"
|
||||
|
||||
def items(self):
|
||||
|
@ -86,6 +86,13 @@ __tests__ = (
|
||||
"#exception": exception.HttpError,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://imgur.com/test-21yMxCS",
|
||||
"#comment" : "slug",
|
||||
"#category": ("", "imgur", "image"),
|
||||
"#class" : imgur.ImgurImageExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://m.imgur.com/r/Celebs/iHJ7tsM",
|
||||
"#category": ("", "imgur", "image"),
|
||||
@ -258,6 +265,13 @@ __tests__ = (
|
||||
"#exception": exception.HttpError,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://imgur.com/a/138-TcBmP",
|
||||
"#comment" : "slug",
|
||||
"#category": ("", "imgur", "album"),
|
||||
"#class" : imgur.ImgurAlbumExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.imgur.com/a/TcBmP",
|
||||
"#comment" : "www",
|
||||
@ -294,6 +308,13 @@ __tests__ = (
|
||||
"#exception": exception.HttpError,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://imgur.com/gallery/guy-gets-out-of-car-during-long-traffic-jam-to-pet-dog-zf2fIms",
|
||||
"#comment" : "slug",
|
||||
"#category": ("", "imgur", "gallery"),
|
||||
"#class" : imgur.ImgurGalleryExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://imgur.com/t/unmuted/26sEhNr",
|
||||
"#category": ("", "imgur", "gallery"),
|
||||
|
Loading…
Reference in New Issue
Block a user