diff --git a/docs/configuration.rst b/docs/configuration.rst index 3a049acbde..fb4d202a3b 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -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 diff --git a/gallery_dl/extractor/cien.py b/gallery_dl/extractor/cien.py index 9c75d198a8..bae86d0764 100644 --- a/gallery_dl/extractor/cien.py +++ b/gallery_dl/extractor/cien.py @@ -82,10 +82,24 @@ def items(self): 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 @@ def _extract_files_video(self, page, files): 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', ""): name = text.extr(download, "

", "<") 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): diff --git a/test/results/cien.py b/test/results/cien.py index d3bf875f4d..ef797216d9 100644 --- a/test/results/cien.py +++ b/test/results/cien.py @@ -50,12 +50,12 @@ "#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", }, {