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

[newgrounds] support more comment embed formats (#6253)

This commit is contained in:
Mike Fährmann 2024-09-30 08:20:50 +02:00
parent 987f6c36c0
commit f3f27496d6
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 17 additions and 2 deletions

View File

@ -32,6 +32,8 @@ class NewgroundsExtractor(Extractor):
self.user_root = "https://{}.newgrounds.com".format(self.user)
def _init(self):
self._extract_comment_urls = re.compile(
r'(?:<img |data-smartload-)src="([^"]+)').findall
self.flash = self.config("flash", True)
fmt = self.config("format")
@ -78,8 +80,7 @@ class NewgroundsExtractor(Extractor):
if "_fallback" in post:
del post["_fallback"]
for url in text.extract_iter(
post["_comment"], 'data-smartload-src="', '"'):
for url in self._extract_comment_urls(post["_comment"]):
post["num"] += 1
post["_index"] = "{}_{:>02}".format(
post["index"], post["num"])

View File

@ -94,6 +94,20 @@ __tests__ = (
),
},
{
"#url" : "https://www.newgrounds.com/art/view/sockdotclip/trickin-treats",
"#comment" : "extra files in comment section as '<img src=' (#6253)",
"#class" : newgrounds.NewgroundsImageExtractor,
"#urls" : (
"https://art.ngfiles.com/images/2811000/2811344_sockdotclip_trickin-treats.png?f1667246310",
"https://art.ngfiles.com/comments/788000/iu_788899_10504416.webp",
"https://art.ngfiles.com/comments/788000/iu_788901_10504416.webp",
"https://art.ngfiles.com/comments/788000/iu_788900_10504416.webp",
"https://art.ngfiles.com/comments/788000/iu_788903_10504416.webp",
"https://art.ngfiles.com/comments/788000/iu_788902_10504416.webp",
),
},
{
"#url" : "https://www.newgrounds.com/art/view/kekiiro/red",
"#comment" : "'adult' rated (#2456)",