1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-25 12:12:34 +01:00
gallery-dl/gallery_dl/downloader/text.py
Mike Fährmann b0353aa02d
rewrite download modules (#29)
- use '.part' files during file-download
- implement continuation of incomplete downloads
- check if file size matches the one reported by server
2017-10-24 12:53:03 +02:00

34 lines
775 B
Python

# -*- coding: utf-8 -*-
# Copyright 2014-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.
"""Downloader module for text: URLs"""
from .common import DownloaderBase
class Downloader(DownloaderBase):
mode = "t"
def __init__(self, session, output):
DownloaderBase.__init__(self, session, output)
self.text = ""
def connect(self, url, offset):
self.text = url[offset + 5:]
return offset, len(url) - 5
def receive(self, file):
file.write(self.text)
def reset(self):
self.text = ""
@staticmethod
def get_extension():
return "txt"