Describe the bug
A clear and concise description of what the bug is.
After setting user info and media to download, the download is not successful and a FileNotFound is shown
To Reproduce
Provide a piece of code to reproduce the problem.
# Getting media ID from code
media_pk1 = cl.media_pk_from_code("CODE1") # album
print(media_pk1)
media_pk2 = cl.media_pk_from_code("CODE2") # album
print(media_pk2)
media_pk3 = cl.media_pk_from_code("CODE3") # photo
print(media_pk3)
media_pk4 = cl.media_pk_from_code("CODE4") # photo
print(media_pk4)
# Download media (verify if media is photo, video, album or clip)
media1 = cl.album_download(media_pk1, folder='/%s' % (target))
Traceback
Show your full traceback so that it is clear where exactly the error occurred.
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[29], line 2
1 # Download media (verify if media is photo, video, album or clip)
----> 2 media1 = cl.album_download(media_pk1, folder='/%s' % (target))
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/instagrapi/mixins/album.py:44, in DownloadAlbumMixin.album_download(self, media_pk, folder)
41 filename = f"{media.user.username}_{resource.pk}"
42 if resource.media_type == 1:
43 paths.append(
---> 44 self.photo_download_by_url(resource.thumbnail_url, filename, folder)
45 )
46 elif resource.media_type == 2:
47 paths.append(
48 self.video_download_by_url(resource.video_url, filename, folder)
49 )
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/instagrapi/mixins/photo.py:94, in DownloadPhotoMixin.photo_download_by_url(self, url, filename, folder)
92 response = requests.get(url, stream=True)
93 response.raise_for_status()
---> 94 with open(path, "wb") as f:
95 response.raw.decode_content = True
96 shutil.copyfileobj(response.raw, f)
FileNotFoundError: [Errno 2] No such file or directory: '/PROFILE-NAME/PROFILE-NAME_MEDIA-ID.jpg'
Expected behavior
A clear and concise description of what you expected to happen.
The files should be downloaded and saved in a folder named after the profile name.
Desktop (please complete the following information):
OS: MacOS Catalina 10.15.7
Python version: 3.11
instagrapi version: 1.36.31 (latest as of 6 February 2023)
Describe the bug A clear and concise description of what the bug is.
After setting user info and media to download, the download is not successful and a FileNotFound is shown
To Reproduce Provide a piece of code to reproduce the problem.
Traceback Show your full traceback so that it is clear where exactly the error occurred.
Expected behavior A clear and concise description of what you expected to happen.
The files should be downloaded and saved in a folder named after the profile name.
Desktop (please complete the following information):