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

[cien] add 'files' option (#2885)

This commit is contained in:
Mike Fährmann 2024-08-03 11:37:14 +02:00
parent f68b0efc1b
commit f87783ff26
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 38 additions and 8 deletions

View File

@ -1448,6 +1448,22 @@ Description
Process reposts.
extractor.cien.files
--------------------
Type
``list`` of ``strings``
Default
``["image", "video", "download", "gallery"]``
Description
Determines the type and order of files to be downloaded.
Available types are
``image``,
``video``,
``download``,
``gallery``.
extractor.cyberdrop.domain
--------------------------
Type

View File

@ -82,10 +82,24 @@ class CienArticleExtractor(CienExtractor):
def _extract_files(self, page):
files = []
self._extract_files_image(page, files)
self._extract_files_video(page, files)
self._extract_files_attachment(page, files)
self._extract_files_gallery(page, files)
filetypes = self.config("files")
if filetypes is None:
self._extract_files_image(page, files)
self._extract_files_video(page, files)
self._extract_files_download(page, files)
self._extract_files_gallery(page, files)
else:
generators = {
"image" : self._extract_files_image,
"video" : self._extract_files_video,
"download": self._extract_files_download,
"gallery" : self._extract_files_gallery,
"gallerie": self._extract_files_gallery,
}
if isinstance(filetypes, str):
filetypes = filetypes.split(",")
for ft in filetypes:
generators[ft.rstrip("s")](page, files)
return files
@ -114,14 +128,14 @@ class CienArticleExtractor(CienExtractor):
file["type"] = "video"
files.append(file)
def _extract_files_attachment(self, page, files):
def _extract_files_download(self, page, files):
for download in text.extract_iter(
page, 'class="downloadBlock', "</div>"):
name = text.extr(download, "<p>", "<")
file = text.nameext_from_url(name.rpartition(" ")[0])
file["url"] = text.extr(download, ' href="', '"')
file["type"] = "attachment"
file["type"] = "download"
files.append(file)
def _extract_files_gallery(self, page, files):

View File

@ -50,12 +50,12 @@ __tests__ = (
"#url" : "https://ci-en.dlsite.com/creator/25509/article/1172460",
"#category": ("", "cien", "article"),
"#class" : cien.CienArticleExtractor,
"#range" : "3",
"#options" : {"files": "download"},
"#pattern" : r"https://media\.ci-en\.jp/private/attachment/creator/00025509/7fd3c039d2277ba9541e82592aca6f6751f6c268404038ccbf1112bcf2f93357/upload/.+\.zip\?px-time=.+",
"filename" : "VP 1.05.4 Tim-v9 ENG rec v3",
"extension": "zip",
"type" : "attachment",
"type" : "download",
},
{