diff options
| author | 2021-12-30 01:56:51 -0500 | |
|---|---|---|
| committer | 2021-12-30 01:56:51 -0500 | |
| commit | 6a849c995173dee7ec29ae2191120bb3a1d74405 (patch) | |
| tree | b04906295296f50556f461e443a4c7633afa4b6d /gallery_dl/extractor/wordpress.py | |
| parent | 6a387c1b3e40110ca315d5a4d260298fa5aa3eb6 (diff) | |
| parent | 7bc30b43b70556630b4a93c03fefc0d888e3d19f (diff) | |
Update upstream source from tag 'upstream/1.20.0'
Update to upstream version '1.20.0'
with Debian dir f271e8ffa4e8d9b8e41546097fc4a4e161e73f8f
Diffstat (limited to 'gallery_dl/extractor/wordpress.py')
| -rw-r--r-- | gallery_dl/extractor/wordpress.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gallery_dl/extractor/wordpress.py b/gallery_dl/extractor/wordpress.py new file mode 100644 index 0000000..dd7d28a --- /dev/null +++ b/gallery_dl/extractor/wordpress.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +# Copyright 2021 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. + +"""Extractors for WordPress blogs""" + +from .common import BaseExtractor, Message +from .. import text + + +class WordpressExtractor(BaseExtractor): + """Base class for wordpress extractors""" + basecategory = "wordpress" + + def items(self): + for post in self.posts(): + yield Message.Difrectory, post + + + +BASE_PATTERN = WordpressExtractor.update({}) + + +class WordpressBlogExtractor(WordpressExtractor): + """Extractor for WordPress blogs""" + subcategory = "blog" + directory_fmt = ("{category}", "{blog}") + pattern = BASE_PATTERN + r"/?$" + + def posts(self): + url = self.root + "/wp-json/wp/v2/posts" + params = {"page": 1, "per_page": "100"} + + while True: + data = self.request(url, params=params).json() + exit() + yield 1 |
