1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-09-11 16:22:24 +02:00

Merge branch 'master' into master

This commit is contained in:
Lars Lindqvist 2018-08-15 20:23:23 +02:00 committed by GitHub
commit 8fd56c379f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 46 deletions

View File

@ -96,12 +96,3 @@ development of Instaloader.
| For Donations, we provide a PayPal.Me link and a Bitcoin address.
| PayPal: `PayPal.me/aandergr <https://www.paypal.me/aandergr>`__
| BTC: 1Nst4LoadeYzrKjJ1DX9CpbLXBYE9RKLwY
For a direct and personal communication within Instaloader's community, we have
an IRC channel
**#instaloader** on **Freenode**.
Freenode provides a `Web IRC Client
<https://webchat.freenode.net/?channels=instaloader>`__, allowing to join our
channel without having an IRC client installed.

View File

@ -102,19 +102,3 @@ development of Instaloader.
.. donations-end
.. (Discussion in :issue:`130`)
IRC Channel
-----------
.. ircchannel-start
For a direct and personal communication within Instaloader's community, we have
an IRC channel
**#instaloader** on **Freenode**.
Freenode provides a `Web IRC Client
<https://webchat.freenode.net/?channels=instaloader>`__, allowing to join our
channel without having an IRC client installed.
.. ircchannel-end

View File

@ -88,10 +88,6 @@ become an even greater tool.
:start-after: donations-start
:end-before: donations-end
.. include:: contributing.rst
:start-after: ircchannel-start
:end-before: ircchannel-end
..
* :ref:`genindex`
* :ref:`modindex`

View File

@ -1,7 +1,7 @@
"""Download pictures (or videos) along with their captions and other metadata from Instagram."""
__version__ = '4.0.7'
__version__ = '4.0.8'
try:

View File

@ -89,6 +89,10 @@ def _main(instaloader: Instaloader, targetlist: List[str],
else:
instaloader.interactive_login(username)
instaloader.context.log("Logged in as %s." % username)
# Determine what to download
download_profile_pic = profile_pic or profile_pic_only
download_profile_posts = not (stories_only or profile_pic_only)
download_profile_stories = stories or stories_only
# Try block for KeyboardInterrupt (save session on ^C)
profiles = set()
anonymous_retry_profiles = set()
@ -141,9 +145,9 @@ def _main(instaloader: Instaloader, targetlist: List[str],
try:
profile = instaloader.check_profile_id(target)
if instaloader.context.is_logged_in and profile.has_blocked_viewer:
if not stories_only and not profile.is_private:
raise ProfileNotExistsException("{} blocked you; But she's public, "
"so we just download her anonymously.".format(target))
if download_profile_pic or (download_profile_posts and not profile.is_private):
raise ProfileNotExistsException("{} blocked you; But we download her anonymously."
.format(target))
else:
instaloader.context.error("{} blocked you.".format(target))
else:
@ -151,7 +155,7 @@ def _main(instaloader: Instaloader, targetlist: List[str],
except ProfileNotExistsException as err:
# Not only our profile.has_blocked_viewer condition raises ProfileNotExistsException,
# check_profile_id() also does, since access to blocked profile may be responded with 404.
if instaloader.context.is_logged_in and not stories_only:
if instaloader.context.is_logged_in and (download_profile_pic or download_profile_posts):
instaloader.context.log(err)
instaloader.context.log("Trying again anonymously, helps in case you are just blocked.")
with instaloader.anonymous_copy() as anonymous_loader:
@ -163,25 +167,23 @@ def _main(instaloader: Instaloader, targetlist: List[str],
if len(profiles) > 1:
instaloader.context.log("Downloading {} profiles: {}".format(len(profiles),
' '.join([p.username for p in profiles])))
if not stories_only:
if download_profile_pic or download_profile_posts:
# Iterate through profiles list and download them
for target in profiles:
with instaloader.context.error_catcher(target):
instaloader.download_profile(target, profile_pic, profile_pic_only,
instaloader.download_profile(target, download_profile_pic, not download_profile_posts,
fast_update, download_tagged=tagged,
download_tagged_only=tagged_only,
post_filter=post_filter)
download_tagged_only=tagged_only, post_filter=post_filter)
if anonymous_retry_profiles:
instaloader.context.log("Downloading anonymously: {}"
.format(' '.join([p.username for p in anonymous_retry_profiles])))
with instaloader.anonymous_copy() as anonymous_loader:
for target in anonymous_retry_profiles:
with instaloader.context.error_catcher(target):
anonymous_loader.download_profile(target, profile_pic, profile_pic_only,
anonymous_loader.download_profile(target, download_profile_pic, not download_profile_posts,
fast_update, download_tagged=tagged,
download_tagged_only=tagged_only,
post_filter=post_filter)
if stories or stories_only:
download_tagged_only=tagged_only, post_filter=post_filter)
if download_profile_stories and profiles:
with instaloader.context.error_catcher("Download stories"):
instaloader.context.log("Downloading stories")
instaloader.download_stories(userids=list(profiles), fast_update=fast_update,

View File

@ -75,10 +75,12 @@ class InstaloaderContext:
username = self.username
self._session = self.get_anonymous_session()
self.username = None
yield self
self._session.close()
self.username = username
self._session = session
try:
yield self
finally:
self._session.close()
self.username = username
self._session = session
@property
def is_logged_in(self) -> bool:

View File

@ -552,6 +552,8 @@ class Profile:
@property
def has_viewable_story(self) -> bool:
"""
.. deprecated:: 4.0.6
Some stories are private. This property determines if the :class:`Profile`
has at least one story which can be viewed using the associated :class:`InstaloaderContext`,
i.e. the viewer has privileges to view it.