[newgrounds] support 'art-image' files (#4642)
This commit is contained in:
@@ -57,7 +57,8 @@ class NewgroundsExtractor(Extractor):
|
|||||||
yield Message.Url, url, text.nameext_from_url(url, post)
|
yield Message.Url, url, text.nameext_from_url(url, post)
|
||||||
|
|
||||||
for num, url in enumerate(text.extract_iter(
|
for num, url in enumerate(text.extract_iter(
|
||||||
post["_comment"], 'data-smartload-src="', '"'), 1):
|
post["_images"] + post["_comment"],
|
||||||
|
'data-smartload-src="', '"'), 1):
|
||||||
post["num"] = num
|
post["num"] = num
|
||||||
post["_index"] = "{}_{:>02}".format(post["index"], num)
|
post["_index"] = "{}_{:>02}".format(post["index"], num)
|
||||||
url = text.ensure_http_scheme(url)
|
url = text.ensure_http_scheme(url)
|
||||||
@@ -135,6 +136,7 @@ class NewgroundsExtractor(Extractor):
|
|||||||
extr = text.extract_from(page)
|
extr = text.extract_from(page)
|
||||||
data = extract_data(extr, post_url)
|
data = extract_data(extr, post_url)
|
||||||
|
|
||||||
|
data["_images"] = extr('<div class="art-images', '\n</div>')
|
||||||
data["_comment"] = extr(
|
data["_comment"] = extr(
|
||||||
'id="author_comments"', '</div>').partition(">")[2]
|
'id="author_comments"', '</div>').partition(">")[2]
|
||||||
data["comment"] = text.unescape(text.remove_html(
|
data["comment"] = text.unescape(text.remove_html(
|
||||||
|
|||||||
@@ -12,17 +12,17 @@ __tests__ = (
|
|||||||
"#url" : "https://www.newgrounds.com/art/view/tomfulp/ryu-is-hawt",
|
"#url" : "https://www.newgrounds.com/art/view/tomfulp/ryu-is-hawt",
|
||||||
"#category": ("", "newgrounds", "image"),
|
"#category": ("", "newgrounds", "image"),
|
||||||
"#class" : newgrounds.NewgroundsImageExtractor,
|
"#class" : newgrounds.NewgroundsImageExtractor,
|
||||||
"#sha1_url" : "57f182bcbbf2612690c3a54f16ffa1da5105245e",
|
"#urls" : "https://art.ngfiles.com/images/1993000/1993615_4474_tomfulp_ryu-is-hawt.44f81090378ae9c257a5e46a8e17cc4d.gif?f1695674895",
|
||||||
"#sha1_content": "8f395e08333eb2457ba8d8b715238f8910221365",
|
"#sha1_content": "8f395e08333eb2457ba8d8b715238f8910221365",
|
||||||
|
|
||||||
"artist" : ["tomfulp"],
|
"artist" : ["tomfulp"],
|
||||||
"comment" : r"re:Consider this the bottom threshold for ",
|
"comment" : "Consider this the bottom threshold for scouted artists.In fact consider it BELOW the bottom threshold.",
|
||||||
"date" : "dt:2009-06-04 14:44:05",
|
"date" : "dt:2009-06-04 14:44:05",
|
||||||
"description": r"re:Consider this the bottom threshold for ",
|
"description": "Consider this the bottom threshold for scouted artists. In fact consider it BELOW the bottom threshold. ",
|
||||||
"favorites" : int,
|
"favorites" : int,
|
||||||
"filename" : "94_tomfulp_ryu-is-hawt",
|
"filename" : "1993615_4474_tomfulp_ryu-is-hawt.44f81090378ae9c257a5e46a8e17cc4d",
|
||||||
"height" : 476,
|
"height" : 476,
|
||||||
"index" : 94,
|
"index" : 1993615,
|
||||||
"rating" : "e",
|
"rating" : "e",
|
||||||
"score" : float,
|
"score" : float,
|
||||||
"tags" : [
|
"tags" : [
|
||||||
@@ -39,15 +39,32 @@ __tests__ = (
|
|||||||
"#url" : "https://art.ngfiles.com/images/0/94_tomfulp_ryu-is-hawt.gif",
|
"#url" : "https://art.ngfiles.com/images/0/94_tomfulp_ryu-is-hawt.gif",
|
||||||
"#category": ("", "newgrounds", "image"),
|
"#category": ("", "newgrounds", "image"),
|
||||||
"#class" : newgrounds.NewgroundsImageExtractor,
|
"#class" : newgrounds.NewgroundsImageExtractor,
|
||||||
"#sha1_url": "57f182bcbbf2612690c3a54f16ffa1da5105245e",
|
"#urls" : "https://art.ngfiles.com/images/1993000/1993615_4474_tomfulp_ryu-is-hawt.44f81090378ae9c257a5e46a8e17cc4d.gif?f1695674895",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://www.newgrounds.com/art/view/sailoryon/yon-dream-buster",
|
"#url" : "https://www.newgrounds.com/art/view/sailoryon/yon-dream-buster",
|
||||||
|
"#comment" : "embedded file in 'comments' (#1033)",
|
||||||
"#category": ("", "newgrounds", "image"),
|
"#category": ("", "newgrounds", "image"),
|
||||||
"#class" : newgrounds.NewgroundsImageExtractor,
|
"#class" : newgrounds.NewgroundsImageExtractor,
|
||||||
"#count" : 2,
|
"#urls" : (
|
||||||
"#sha1_url": "84eec95e663041a80630df72719f231e157e5f5d",
|
"https://art.ngfiles.com/images/1438000/1438673_sailoryon_yon-dream-buster.jpg?f1601058173",
|
||||||
|
"https://art.ngfiles.com/comments/172000/iu_172374_7112211.jpg",
|
||||||
|
),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://www.newgrounds.com/art/view/zedrinbot/lewd-animation-tutorial",
|
||||||
|
"#comment" : "extra files in 'art-image-row' elements (#4642)",
|
||||||
|
"#category": ("", "newgrounds", "image"),
|
||||||
|
"#class" : newgrounds.NewgroundsImageExtractor,
|
||||||
|
"#urls" : (
|
||||||
|
"https://art.ngfiles.com/images/5091000/5091275_45067_zedrinbot_untitled-5091275.0a9d27ed2bc265a7e89478ed6ad6f86f.gif?f1696187399",
|
||||||
|
"https://art.ngfiles.com/medium_views/5091000/5091275_45071_zedrinbot_untitled-5091275.6fdc62eaef43528fb1c9bda624d30a3d.webp?f1696187437",
|
||||||
|
"https://art.ngfiles.com/medium_views/5091000/5091275_45070_zedrinbot_untitled-5091275.0d7334746374465bd448908b88d1f810.webp?f1696187435",
|
||||||
|
"https://art.ngfiles.com/medium_views/5091000/5091275_45072_zedrinbot_untitled-5091275.6fdc62eaef43528fb1c9bda624d30a3d.webp?f1696187438",
|
||||||
|
"https://art.ngfiles.com/medium_views/5091000/5091275_45073_zedrinbot_untitled-5091275.20aa05c1cd22fd058e8c68ce58f5a302.webp?f1696187439",
|
||||||
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user