From 96e13604daba11ccae1a3be521450fc26b277c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 14 Jul 2017 13:25:53 +0200 Subject: [PATCH] [archivedmoe] add thread extractor --- gallery_dl/extractor/__init__.py | 1 + gallery_dl/extractor/archivedmoe.py | 32 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 gallery_dl/extractor/archivedmoe.py diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index aa014743..9839802f 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -16,6 +16,7 @@ modules = [ "4chan", "4plebs", "8chan", + "archivedmoe", "batoto", "danbooru", "desuarchive", diff --git a/gallery_dl/extractor/archivedmoe.py b/gallery_dl/extractor/archivedmoe.py new file mode 100644 index 00000000..955e1576 --- /dev/null +++ b/gallery_dl/extractor/archivedmoe.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +# Copyright 2017 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. + +"""Extract images from https://archived.moe/""" + +from . import chan + + +class ArchivedmoeThreadExtractor(chan.FoolfuukaThreadExtractor): + """Extractor for images from threads on archived.moe""" + category = "archivedmoe" + root = "https://archived.moe" + pattern = [r"(?:https?://)?archived\.moe/([^/]+)/thread/(\d+)"] + test = [ + ("https://archived.moe/gd/thread/309639/", { + "url": "fdd533840e2d535abd162c02d6dfadbc12e2dcd8", + "content": "c27e2a7be3bc989b5dd859f7789cc854db3f5573", + }), + ("https://archived.moe/a/thread/159767162/", { + "url": "ffec05a1a1b906b5ca85992513671c9155ee9e87", + }), + ] + + def __init__(self, match): + chan.FoolfuukaThreadExtractor.__init__(self, match) + self.session.headers["User-Agent"] = "Mozilla 5.0" + self.session.headers["Referer"] = self.root