2015-04-10 21:45:41 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2019-06-19 22:19:29 +02:00
|
|
|
# Copyright 2014-2019 Mike Fährmann
|
2015-04-10 21:45:41 +02:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2017-10-24 12:53:03 +02:00
|
|
|
"""Downloader module for text: URLs"""
|
2015-04-10 21:45:41 +02:00
|
|
|
|
2017-10-24 12:53:03 +02:00
|
|
|
from .common import DownloaderBase
|
2014-10-12 21:56:44 +02:00
|
|
|
|
2017-01-30 19:40:15 +01:00
|
|
|
|
2018-11-16 14:40:05 +01:00
|
|
|
class TextDownloader(DownloaderBase):
|
2017-10-26 22:11:36 +02:00
|
|
|
scheme = "text"
|
2014-10-12 21:56:44 +02:00
|
|
|
|
2019-06-19 22:19:29 +02:00
|
|
|
def download(self, url, pathfmt):
|
|
|
|
if self.part:
|
|
|
|
pathfmt.part_enable(self.partdir)
|
|
|
|
self.out.start(pathfmt.path)
|
2024-06-14 01:22:00 +02:00
|
|
|
with pathfmt.open("wb") as fp:
|
|
|
|
fp.write(url.encode()[5:])
|
2019-06-19 22:19:29 +02:00
|
|
|
return True
|
2018-11-16 14:40:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
__downloader__ = TextDownloader
|