mirror of
https://github.com/instaloader/instaloader.git
synced 2026-10-23 17:09:37 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ece0d11915 | ||
|
|
41e734e1b8 | ||
|
|
b7ea0d5953 | ||
|
|
325e89c4b2 |
@@ -1,7 +1,7 @@
|
|||||||
"""Download pictures (or videos) along with their captions and other metadata from Instagram."""
|
"""Download pictures (or videos) along with their captions and other metadata from Instagram."""
|
||||||
|
|
||||||
|
|
||||||
__version__ = '4.1'
|
__version__ = '4.1.1'
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -358,18 +358,18 @@ class Instaloader:
|
|||||||
os.makedirs(os.path.dirname(filename), exist_ok=True)
|
os.makedirs(os.path.dirname(filename), exist_ok=True)
|
||||||
|
|
||||||
# Download the image(s) / video thumbnail and videos within sidecars if desired
|
# Download the image(s) / video thumbnail and videos within sidecars if desired
|
||||||
downloaded = False
|
downloaded = True
|
||||||
if self.download_pictures:
|
if self.download_pictures:
|
||||||
if post.typename == 'GraphSidecar':
|
if post.typename == 'GraphSidecar':
|
||||||
edge_number = 1
|
edge_number = 1
|
||||||
for sidecar_node in post.get_sidecar_nodes():
|
for sidecar_node in post.get_sidecar_nodes():
|
||||||
# Download picture or video thumbnail
|
# Download picture or video thumbnail
|
||||||
if not sidecar_node.is_video or self.download_video_thumbnails is True:
|
if not sidecar_node.is_video or self.download_video_thumbnails is True:
|
||||||
downloaded |= self.download_pic(filename=filename, url=sidecar_node.display_url,
|
downloaded &= self.download_pic(filename=filename, url=sidecar_node.display_url,
|
||||||
mtime=post.date_local, filename_suffix=str(edge_number))
|
mtime=post.date_local, filename_suffix=str(edge_number))
|
||||||
# Additionally download video if available and desired
|
# Additionally download video if available and desired
|
||||||
if sidecar_node.is_video and self.download_videos is True:
|
if sidecar_node.is_video and self.download_videos is True:
|
||||||
downloaded |= self.download_pic(filename=filename, url=sidecar_node.video_url,
|
downloaded &= self.download_pic(filename=filename, url=sidecar_node.video_url,
|
||||||
mtime=post.date_local, filename_suffix=str(edge_number))
|
mtime=post.date_local, filename_suffix=str(edge_number))
|
||||||
edge_number += 1
|
edge_number += 1
|
||||||
elif post.typename == 'GraphImage':
|
elif post.typename == 'GraphImage':
|
||||||
@@ -387,7 +387,7 @@ class Instaloader:
|
|||||||
|
|
||||||
# Download video if desired
|
# Download video if desired
|
||||||
if post.is_video and self.download_videos is True:
|
if post.is_video and self.download_videos is True:
|
||||||
downloaded |= self.download_pic(filename=filename, url=post.video_url, mtime=post.date_local)
|
downloaded &= self.download_pic(filename=filename, url=post.video_url, mtime=post.date_local)
|
||||||
|
|
||||||
# Download geotags if desired
|
# Download geotags if desired
|
||||||
if self.download_geotags and post.location:
|
if self.download_geotags and post.location:
|
||||||
@@ -823,7 +823,7 @@ class Instaloader:
|
|||||||
self.download_profilepic(profile)
|
self.download_profilepic(profile)
|
||||||
|
|
||||||
# Catch some errors
|
# Catch some errors
|
||||||
if profile.is_private:
|
if profile.is_private and (tagged or highlights or posts):
|
||||||
if not self.context.is_logged_in:
|
if not self.context.is_logged_in:
|
||||||
raise LoginRequiredException("--login=USERNAME required.")
|
raise LoginRequiredException("--login=USERNAME required.")
|
||||||
if not profile.followed_by_viewer and self.context.username != profile.username:
|
if not profile.followed_by_viewer and self.context.username != profile.username:
|
||||||
|
|||||||
@@ -306,6 +306,7 @@ class InstaloaderContext:
|
|||||||
if isinstance(err, TooManyRequestsException):
|
if isinstance(err, TooManyRequestsException):
|
||||||
print(textwrap.fill(text_for_429), file=sys.stderr)
|
print(textwrap.fill(text_for_429), file=sys.stderr)
|
||||||
if is_graphql_query:
|
if is_graphql_query:
|
||||||
|
print("Made {} GraphQL requests.".format(len(self.query_timestamps)), file=sys.stderr)
|
||||||
waittime = graphql_query_waittime(untracked_queries=True)
|
waittime = graphql_query_waittime(untracked_queries=True)
|
||||||
if waittime > 0:
|
if waittime > 0:
|
||||||
self.log('The request will be retried in {} seconds, at {:%H:%M}.'
|
self.log('The request will be retried in {} seconds, at {:%H:%M}.'
|
||||||
|
|||||||
@@ -63,6 +63,12 @@ class TestInstaloaderAnonymously(unittest.TestCase):
|
|||||||
def test_hashtag_download(self):
|
def test_hashtag_download(self):
|
||||||
self.L.download_hashtag(HASHTAG, NORMAL_MAX_COUNT)
|
self.L.download_hashtag(HASHTAG, NORMAL_MAX_COUNT)
|
||||||
|
|
||||||
|
def test_hashtag_paging(self):
|
||||||
|
for count, post in enumerate(self.L.get_hashtag_posts(HASHTAG)):
|
||||||
|
print(post)
|
||||||
|
if count == PAGING_MAX_COUNT:
|
||||||
|
break
|
||||||
|
|
||||||
def test_get_id_by_username(self):
|
def test_get_id_by_username(self):
|
||||||
self.assertEqual(PUBLIC_PROFILE_ID,
|
self.assertEqual(PUBLIC_PROFILE_ID,
|
||||||
instaloader.Profile.from_username(self.L.context, PUBLIC_PROFILE).userid)
|
instaloader.Profile.from_username(self.L.context, PUBLIC_PROFILE).userid)
|
||||||
|
|||||||
Reference in New Issue
Block a user