1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-26 04:32:51 +01:00
gallery-dl/gallery_dl/downloader/text.py

27 lines
660 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
# Copyright 2014-2019 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
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):
scheme = "text"
2014-10-12 21:56:44 +02:00
def download(self, url, pathfmt):
if self.part:
pathfmt.part_enable(self.partdir)
self.out.start(pathfmt.path)
with pathfmt.open("wb") as fp:
fp.write(url.encode()[5:])
return True
2018-11-16 14:40:05 +01:00
__downloader__ = TextDownloader