diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index b3c812bf..281e9293 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -201,6 +201,7 @@ modules = [ "directlink", "recursive", "oauth", + "noop", "ytdl", "generic", ] diff --git a/gallery_dl/extractor/noop.py b/gallery_dl/extractor/noop.py new file mode 100644 index 00000000..df2316c4 --- /dev/null +++ b/gallery_dl/extractor/noop.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +# Copyright 2024 Mike Fährmann +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +"""noop extractor""" + +from .common import Extractor, Message + + +class NoopExtractor(Extractor): + category = "noop" + pattern = r"(?i)noo?p$" + example = "noop" + + def items(self): + # yield *something* to prevent a 'No results' message + yield Message.Version, 1 + + # Save cookies manually, since it happens automatically only after + # extended extractor initialization, i.e. Message.Directory, which + # itself might cause some unintended effects. + if self.cookies: + self.cookies_store() diff --git a/scripts/supportedsites.py b/scripts/supportedsites.py index 1488428c..182f7667 100755 --- a/scripts/supportedsites.py +++ b/scripts/supportedsites.py @@ -441,6 +441,7 @@ IGNORE_LIST = ( "test", "ytdl", "generic", + "noop", ) diff --git a/test/results/noop.py b/test/results/noop.py new file mode 100644 index 00000000..93556817 --- /dev/null +++ b/test/results/noop.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +from gallery_dl.extractor import noop + + +__tests__ = ( +{ + "#url" : "noop", + "#class" : noop.NoopExtractor, + "#urls" : (), + "#count" : 0, +}, + +{ + "#url" : "nop", + "#class" : noop.NoopExtractor, +}, + +{ + "#url" : "NOOP", + "#class" : noop.NoopExtractor, +}, + +)