diff options
author | Florian Pritz <bluewind@xinu.at> | 2019-02-06 16:38:29 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2019-02-06 16:38:29 +0100 |
commit | c29e58d29debb86a55d2eb38e7033928df769003 (patch) | |
tree | b3b72659c72fe7d2ac898bc141daecd70e09cdaa | |
parent | a439efc95c1299d274aea93524b22311ab7d8ce4 (diff) |
Extract url_to_file method
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-x | fb.py | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -681,12 +681,14 @@ class FBClient: if arg.startswith(self.config['pastebin']): return File(id=self.extractId(arg)) if re.match('https?://', arg): - outfile = os.path.join(self.tempdir, os.path.basename(arg.strip("/"))) - self.curlw.dl_file(arg, outfile) - return File(outfile) + return self.url_to_file(arg) return File(arg) + def url_to_file(self, url): + outfile = os.path.join(self.tempdir, os.path.basename(url.strip("/"))) + self.curlw.dl_file(url, outfile) + return File(outfile) def extractId(self, arg): arg = arg.replace(self.config['pastebin'], '') |