diff options
| author | 2019-07-02 04:33:45 -0400 | |
|---|---|---|
| committer | 2019-07-02 04:33:45 -0400 | |
| commit | 195c45911e79c33cf0bb986721365fb06df5a153 (patch) | |
| tree | ac0c9b6ef40bea7aa7ab0c5c3cb500eb510668fa /gallery_dl/downloader/text.py | |
Import Upstream version 1.8.7upstream/1.8.7
Diffstat (limited to 'gallery_dl/downloader/text.py')
| -rw-r--r-- | gallery_dl/downloader/text.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gallery_dl/downloader/text.py b/gallery_dl/downloader/text.py new file mode 100644 index 0000000..ca33863 --- /dev/null +++ b/gallery_dl/downloader/text.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +# Copyright 2014-2018 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. + +"""Downloader module for text: URLs""" + +from .common import DownloaderBase + + +class TextDownloader(DownloaderBase): + scheme = "text" + + def __init__(self, extractor, output): + DownloaderBase.__init__(self, extractor, output) + self.content = b"" + + def connect(self, url, offset): + data = url.encode() + self.content = data[offset + 5:] + return offset, len(data) - 5 + + def receive(self, file): + file.write(self.content) + + def reset(self): + self.content = b"" + + @staticmethod + def get_extension(): + return "txt" + + +__downloader__ = TextDownloader |
