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

[nijie] support downloading videos (#5707, #5617)

This commit is contained in:
Mike Fährmann 2024-06-08 22:55:28 +02:00
parent e17b1d5073
commit 2e11b6e756
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 19 additions and 4 deletions

View File

@ -56,7 +56,7 @@ class NijieExtractor(AsynchronousMixin, BaseExtractor):
data["user_id"] = data["artist_id"]
data["user_name"] = data["artist_name"]
urls = list(self._extract_images(image_id, page))
urls = self._extract_images(image_id, page)
data["count"] = len(urls)
yield Message.Directory, data
@ -113,11 +113,14 @@ class NijieExtractor(AsynchronousMixin, BaseExtractor):
# multiple images
url = "{}/view_popup.php?id={}".format(self.root, image_id)
page = self.request(url).text
yield from text.extract_iter(
page, 'href="javascript:void(0);"><img src="', '"')
return [
text.extr(media, ' src="', '"')
for media in text.extract_iter(
page, 'href="javascript:void(0);"><', '>')
]
else:
pos = page.find('id="view-center"') + 1
yield text.extract(page, 'itemprop="image" src="', '"', pos)[0]
return (text.extr(page, 'itemprop="image" src="', '"', pos),)
@staticmethod
def _extract_user_name(page):

View File

@ -165,6 +165,18 @@ __tests__ = (
"#urls" : "https://pic.nijie.net/03/nijie/13/98/498/illust/0_0_703023d18ca8d058_bca943.jpg",
},
{
"#url" : "https://nijie.info/view.php?id=385585",
"#comment" : "video (#5707)",
"#category": ("Nijie", "nijie", "image"),
"#class" : nijie.NijieImageExtractor,
"#urls" : (
"https://pic.nijie.net/01/nijie/20/82/59182/illust/0_0_162270ef49e2ee28_fab5ae.mp4",
"https://pic.nijie.net/04/nijie/20/82/59182/illust/385585_0_ff2d5d19129530d5_b2821e.jpg",
"https://pic.nijie.net/01/nijie/20/82/59182/illust/385585_1_7ee1a2a67bed2f84_212d67.jpg",
),
},
{
"#url" : "https://nijie.info/view.php?id=70724",
"#category": ("Nijie", "nijie", "image"),