Skip to content

Commit

Permalink
[newgrounds] support more comment embed formats (#6253)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Sep 30, 2024
1 parent 987f6c3 commit f3f2749
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gallery_dl/extractor/newgrounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def __init__(self, match):
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")
Expand Down Expand Up @@ -78,8 +80,7 @@ def items(self):
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"])
Expand Down
14 changes: 14 additions & 0 deletions test/results/newgrounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,20 @@
),
},

{
"#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)",
Expand Down

0 comments on commit f3f2749

Please sign in to comment.