Debian Codegraph @

gallery_dl/downloader/text.py

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2
3 # Copyright 2014-2019 Mike Fährmann
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License version 2 as
7 # published by the Free Software Foundation.
8
9 """Downloader module for text: URLs"""
10
11 from .common import DownloaderBase
12
13
14 class TextDownloader(DownloaderBase):
15 scheme = "text"
16
17 def download(self, url, pathfmt):
18 if self.part:
19 pathfmt.part_enable(self.partdir)
20 self.out.start(pathfmt.path)
21 with pathfmt.open("wb") as fp:
22 fp.write(url.encode()[5:])
23 return True
24
25
26 __downloader__ = TextDownloader