merge #3589: [redgifs] support v3 URLs

pull/3622/head
Mike Fährmann 2 years ago
commit a6a631f992
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -69,11 +69,17 @@ class RedgifsUserExtractor(RedgifsExtractor):
"""Extractor for redgifs user profiles""" """Extractor for redgifs user profiles"""
subcategory = "user" subcategory = "user"
directory_fmt = ("{category}", "{userName}") directory_fmt = ("{category}", "{userName}")
pattern = r"(?:https?://)?(?:www\.)?redgifs\.com/users/([^/?#]+)" pattern = r"(?:https?://)?(?:\w+\.)?redgifs\.com/users/([^/?#]+)"
test = ("https://www.redgifs.com/users/Natalifiction", { test = (
"pattern": r"https://\w+\.redgifs\.com/[A-Za-z]+\.mp4", ("https://www.redgifs.com/users/Natalifiction", {
"count": ">= 100", "pattern": r"https://\w+\.redgifs\.com/[\w-]+\.mp4",
}) "count": ">= 100",
}),
("https://v3.redgifs.com/users/lamsinka89", {
"pattern": r"https://\w+\.redgifs\.com/[\w-]+\.(mp4|jpg)",
"count": ">= 100",
}),
)
def metadata(self): def metadata(self):
return {"userName": self.key} return {"userName": self.key}
@ -86,13 +92,14 @@ class RedgifsSearchExtractor(RedgifsExtractor):
"""Extractor for redgifs search results""" """Extractor for redgifs search results"""
subcategory = "search" subcategory = "search"
directory_fmt = ("{category}", "Search", "{search}") directory_fmt = ("{category}", "Search", "{search}")
pattern = r"(?:https?://)?(?:www\.)?redgifs\.com/browse/?\?([^#]+)" pattern = r"(?:https?://)?(?:\w+\.)?redgifs\.com/browse/?\?([^#]+)"
test = ( test = (
("https://www.redgifs.com/browse?tags=JAV", { ("https://www.redgifs.com/browse?tags=JAV", {
"pattern": r"https://\w+\.redgifs\.com/[A-Za-z-]+\.(mp4|jpg)", "pattern": r"https://\w+\.redgifs\.com/[A-Za-z-]+\.(mp4|jpg)",
"range": "1-10", "range": "1-10",
"count": 10, "count": 10,
}), }),
("https://v3.redgifs.com/browse?tags=JAV"),
("https://www.redgifs.com/browse?type=i&verified=y&order=top7"), ("https://www.redgifs.com/browse?type=i&verified=y&order=top7"),
) )
@ -109,7 +116,7 @@ class RedgifsImageExtractor(RedgifsExtractor):
"""Extractor for individual gifs from redgifs.com""" """Extractor for individual gifs from redgifs.com"""
subcategory = "image" subcategory = "image"
pattern = (r"(?:https?://)?(?:" pattern = (r"(?:https?://)?(?:"
r"(?:www\.)?redgifs\.com/(?:watch|ifr)|" r"(?:\w+\.)?redgifs\.com/(?:watch|ifr)|"
r"(?:www\.)?gifdeliverynetwork\.com|" r"(?:www\.)?gifdeliverynetwork\.com|"
r"i\.redgifs\.com/i)/([A-Za-z]+)") r"i\.redgifs\.com/i)/([A-Za-z]+)")
test = ( test = (
@ -121,6 +128,7 @@ class RedgifsImageExtractor(RedgifsExtractor):
("https://redgifs.com/ifr/FoolishForkedAbyssiniancat"), ("https://redgifs.com/ifr/FoolishForkedAbyssiniancat"),
("https://i.redgifs.com/i/FoolishForkedAbyssiniancat"), ("https://i.redgifs.com/i/FoolishForkedAbyssiniancat"),
("https://www.gifdeliverynetwork.com/foolishforkedabyssiniancat"), ("https://www.gifdeliverynetwork.com/foolishforkedabyssiniancat"),
("https://v3.redgifs.com/watch/FoolishForkedAbyssiniancat"),
) )
def gifs(self): def gifs(self):

Loading…
Cancel
Save