From c93f7d749698dc9372416b0de5d126cc0e216725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 15 Jul 2017 13:23:04 +0200 Subject: [PATCH] [archiveofsins] add thread extractor --- gallery_dl/extractor/__init__.py | 1 + gallery_dl/extractor/archivedmoe.py | 5 ----- gallery_dl/extractor/archiveofsins.py | 23 +++++++++++++++++++++++ gallery_dl/extractor/chan.py | 2 ++ 4 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 gallery_dl/extractor/archiveofsins.py diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index 9839802f..527d41ca 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -17,6 +17,7 @@ modules = [ "4plebs", "8chan", "archivedmoe", + "archiveofsins", "batoto", "danbooru", "desuarchive", diff --git a/gallery_dl/extractor/archivedmoe.py b/gallery_dl/extractor/archivedmoe.py index 955e1576..a72eeef4 100644 --- a/gallery_dl/extractor/archivedmoe.py +++ b/gallery_dl/extractor/archivedmoe.py @@ -25,8 +25,3 @@ class ArchivedmoeThreadExtractor(chan.FoolfuukaThreadExtractor): "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 diff --git a/gallery_dl/extractor/archiveofsins.py b/gallery_dl/extractor/archiveofsins.py new file mode 100644 index 00000000..cdd58e39 --- /dev/null +++ b/gallery_dl/extractor/archiveofsins.py @@ -0,0 +1,23 @@ +# -*- 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://archiveofsins.com/""" + +from . import chan + + +class ArchiveofsinsThreadExtractor(chan.FoolfuukaThreadExtractor): + """Extractor for images from threads on archiveofsins.com""" + category = "archiveofsins" + root = "https://archiveofsins.com" + pattern = [r"(?:https?://)?(?:www\.)?archiveofsins\.com" + r"/([^/]+)/thread/(\d+)"] + test = [("https://www.archiveofsins.com/h/thread/4668813/", { + "url": "f612d287087e10a228ef69517cf811539db9a102", + "content": "0dd92d0d8a7bf6e2f7d1f5ac8954c1bcf18c22a4", + })] diff --git a/gallery_dl/extractor/chan.py b/gallery_dl/extractor/chan.py index e58cdc3f..f359ec6b 100644 --- a/gallery_dl/extractor/chan.py +++ b/gallery_dl/extractor/chan.py @@ -73,6 +73,8 @@ class FoolfuukaThreadExtractor(Extractor): def __init__(self, match): Extractor.__init__(self) self.board, self.thread = match.groups() + self.session.headers["User-Agent"] = "Mozilla 5.0" + self.session.headers["Referer"] = self.root def items(self): op = True