1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-21 18:22:30 +01:00

[noop] add 'noop' extractor

This commit is contained in:
Mike Fährmann 2024-10-28 15:49:39 +01:00
parent 76f855d87b
commit 5de8576ff6
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
4 changed files with 57 additions and 0 deletions

View File

@ -201,6 +201,7 @@ modules = [
"directlink",
"recursive",
"oauth",
"noop",
"ytdl",
"generic",
]

View File

@ -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()

View File

@ -441,6 +441,7 @@ IGNORE_LIST = (
"test",
"ytdl",
"generic",
"noop",
)

28
test/results/noop.py Normal file
View File

@ -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,
},
)