Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile ID in filename #22

Closed
mmoraes opened this issue Jun 24, 2017 · 6 comments
Closed

Profile ID in filename #22

mmoraes opened this issue Jun 24, 2017 · 6 comments
Assignees
Labels
feature suggestion Feature suggestion

Comments

@mmoraes
Copy link

mmoraes commented Jun 24, 2017

Firstly, thanks for this great tool 馃檪

I have a question: would it be possible to save the profile ID in file names?

Example:

  1. I'm looking for photos matching the hashtag #cat
  2. These are the profiles/users with photos/videos matching that hashtag:
  • @cute_cats
  • @catsofjapan
  • @catmania
  1. These should be the downloaded files, saved as:
  • cute_cats__2017-06-24_14-30-06.jpg
  • catsofjapan__2017-06-24_14-30-20.jpg
  • catmania__2017-06-24_14-30-36.jpg
  • catmania__2017-06-24_14-31-24.mp4
@aandergr
Copy link
Member

Hi Mateus,

thanks for your interest in our tool! Normally, Instaloader uses directory names to encode the profile ID, i.e. pictures are usually downloaded into PROFILE/TIMESTAMP.jpg. My latest commit, 591dfd3, adds the option --no-profile-subdir to download the pictures into PROFILE__TIMESTAMP.jpg, as you suggested. However, it is still in the v2-dev branch which requires a bit of testing until we merge it into the master branch and release a new version.

Nevertheless, you may already install it with
pip3 install --upgrade git+https://github.com/Thammus/instaloader@v2-dev

Happy instaloading!
Alex

@aandergr
Copy link
Member

Anyway, in the case of downloading hashtags, instead of the profile ID, the hashtag name is encoded in the downloaded file's path, leaving this issue unresolved. I will soon take a deeper look into how we could determine the profile ID in the case of downloading by hashtag.

@mmoraes
Copy link
Author

mmoraes commented Jun 26, 2017

Thanks, @aandergr!

aandergr added a commit that referenced this issue Jun 27, 2017
With --hashtag-username given, if downloading per #hashtag, instead of
per username, for each picture an additional request to the Instagram
server is issued to lookup the picture's username. Instead of storing
files in #hashtag/timestamp.jpg, files are stored in
username/timestamp.jpg as it is the default when not downloading per
hashtag.

This closes #22.
@aandergr
Copy link
Member

The latest commit adds the option --hashtag-username to lookup the owner's username for each picture when downloading by-hashtag, and use it to select the file's directory to download to, as it is the default when downloading by-profile.

Thus, to get your desired behavior, you can now call Instaloader with
instaloader --hashtag-username --no-profile-subdir #cat

We leave this issue open until the recent commits have been well tested and merged into master branch. caf75a8 was a long-awaited refactoring and I fear that it broke things.

Best regards,
Alex

@aandergr aandergr added the feature suggestion Feature suggestion label Jun 27, 2017
@aandergr aandergr self-assigned this Jun 27, 2017
@mmoraes
Copy link
Author

mmoraes commented Jun 28, 2017

I really appreciate your help, Alex! 馃檪

@aandergr
Copy link
Member

aandergr commented Jul 25, 2017

Commit 8572e52 makes options --hastag-username and --no-profile-subdir obsolete and removes them.

In the latest v2-dev version, the behavior of the former --hastag-username --no-profile-subdir can be achieved with passing
--dirname-pattern='.' --filename-pattern='{profile}__{date:%Y-%m-%d_%H-%M-%S}'

Happy instaloading!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature suggestion Feature suggestion
Projects
None yet
Development

No branches or pull requests

2 participants