1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-11-04 09:22:29 +01:00

Allow subdirectories in filename pattern

Changed invocations of os.makedirs() in order to respect directories in
the filename pattern.
This commit is contained in:
André Koch-Kramer 2017-07-29 01:40:53 +02:00
parent 13d288ef36
commit 99620ec766

View File

@ -578,7 +578,7 @@ class Instaloader:
filename = dirname + '/' + self.filename_pattern.format(profile=profilename, target=target.lower(), filename = dirname + '/' + self.filename_pattern.format(profile=profilename, target=target.lower(),
date=datetime.datetime.fromtimestamp(date), date=datetime.datetime.fromtimestamp(date),
shortcode=shortcode) shortcode=shortcode)
os.makedirs(dirname, exist_ok=True) os.makedirs(os.path.dirname(filename), exist_ok=True)
if '__typename' in node: if '__typename' in node:
if node['__typename'] == 'GraphSidecar': if node['__typename'] == 'GraphSidecar':
self._sleep() self._sleep()
@ -695,7 +695,7 @@ class Instaloader:
filename = dirname + '/' + self.filename_pattern.format(profile=name, target=':stories', filename = dirname + '/' + self.filename_pattern.format(profile=name, target=':stories',
date=date_stamp, date=date_stamp,
shortcode=shortcode) shortcode=shortcode)
os.makedirs(dirname, exist_ok=True) os.makedirs(os.path.dirname(filename), exist_ok=True)
if "image_versions2" in item: if "image_versions2" in item:
url = item["image_versions2"]["candidates"][0]["url"] url = item["image_versions2"]["candidates"][0]["url"]
downloaded = self.download_pic(filename=filename, downloaded = self.download_pic(filename=filename,