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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you add support to download #hashtag feeds? #18

Closed
seanpatel opened this issue Apr 17, 2017 · 7 comments
Closed

Can you add support to download #hashtag feeds? #18

seanpatel opened this issue Apr 17, 2017 · 7 comments
Labels
feature suggestion Feature suggestion

Comments

@seanpatel
Copy link

Would be nice if you can add support to download #hashtag pics and videos.

Since there could be 1000s or even millions for #hashtag feed, maybe you can have parameters for max # of media to download, or from x date to y date, etc.

Here's example Link: #WWF :
Has over 1 million media items.
Here's the URL to get it directly ( graph node json results, with next_cursor / has more pagination)

Pleeaase can you add it ? I can give you amazon gift card or something if you don't want $$ for compensation. Working on a class research project / AI stuff.

aandergr added a commit that referenced this issue Apr 17, 2017
Instaloader is now capable of downloading all pictures associated with
one #hashtag with:
instaloader #hashtag

This implements the feature requested with #18.
@aandergr aandergr added the feature suggestion Feature suggestion label Apr 17, 2017
@aandergr
Copy link
Member

Thanks for your interest and for involving Instaloader in your research project. My latest commit, 3e13601, implements the download_hashtag() function as well as downloading a hashtag with ./instaloader.py #hashtag. The --fast-update flag is also supported, to abort the download as soon as the first already-downloaded picture is encountered.

To download only a certain number of pictures, you'd have to write a small Python snippet:

from instaloader import download_hashtag, get_anonymous_session

download_hashtag('cat', session=get_anonymous_session(), max_count=30)

Thanks a lot for offering compensation. Instaloader is an open source project, developed in our free time as a hobby. It is a pleasure for us to provide this script to the community for free. However, donations may act as a huge motivation for maintaining this project 😊 We can discuss details per email.

@seanpatel
Copy link
Author

Wow! That was fast! Thank so much. I'll try it out. Yes, I can donate to the project. Let me know how. My email = sean_patel @ icloud.com

@seanpatel
Copy link
Author

Hi, I tried the new code and it's not doing anything. I am on Windows. I did the following cmd like u suggest in u r readme.md

pip3 install git+https://github.com/Thammus/instaloader

That's not updating my installation as it's saying I am already on latest 1.2.2 version.

How do I update the library locally?

I also tried a git clone on the url to get latest. But when I run it it's quietly exiting on existing hashtag without doing anything.

Sorry, not a python guy.

@seanpatel seanpatel reopened this Apr 19, 2017
@aandergr
Copy link
Member

To update Instaloader via pip, you'd have to do
pip3 install --upgrade git+https://github.com/Thammus/instaloader
Without the --upgrade flag it doesn't update the package as it notices that the version string didn't change yet.

Anyway there is another thing I just noticed: The # character indicates the beginning of a comment in bash, thus calling instaloader #hashtag will just silently terminate as no arguments will be passed to Instaloader. It is necessary to escape or quote the hashtag:

instaloader "#cat"

(We certainly should mention that in our README.md)

@seanpatel
Copy link
Author

Thank you! I ran the upgrade as you suggested and this was the output.

Installing collected packages: instaloader
  Found existing installation: instaloader 1.2.2
    Uninstalling instaloader-1.2.2:
      Successfully uninstalled instaloader-1.2.2
  Running setup.py install for instaloader: started
    Running setup.py install for instaloader: finished with status 'done'
Successfully installed instaloader-1.2.2

Then I tried the following #hashtag import...

instaloader "#boxingmeme"

and it download a few and then errors out as shown below.

$ instaloader "#boxingmeme"
Retrieving pictures with hashtag #boxingmeme
[  1] #boxingmeme 2017-04-19_15-29-49 [Running the mitts with the IB▒] Traceback (most recent call last):
  File "C:\Python352-32\Scripts\instaloader-script.py", line 9, in <module>
    load_entry_point('instaloader==1.2.2', 'console_scripts', 'instaloader')()
  File "c:\python352-32\lib\site-packages\instaloader.py", line 813, in main
    not args.no_sleep, args.shorter_output, args.quiet)
  File "c:\python352-32\lib\site-packages\instaloader.py", line 726, in download_profiles
    sleep=sleep, quiet=quiet)
  File "c:\python352-32\lib\site-packages\instaloader.py", line 582, in download_hashtag
    shorter_output=shorter_output, quiet=quiet)
  File "c:\python352-32\lib\site-packages\instaloader.py", line 490, in download_node
    video_data['entry_data']['PostPage'][0]['media']['video_url'],
KeyError: 'media'

Seems to work for other hashtags... not sure if the content of that #hashtag stream is messing up your script.

Please advice!

aandergr added a commit that referenced this issue Apr 20, 2017
This should the video downloading issue reported at #18.
@aandergr
Copy link
Member

Indeed, they seem to have changed some details of video node metadata. Thanks for reporting this!

My latest commit, 6b345e1, should fix it.

@seanpatel
Copy link
Author

That works. Wow, you are awesome!!! Thanks ~!!!

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