Compare commits

..
6 Commits
3 changed files with 9 additions and 17 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
"""Download pictures (or videos) along with their captions and other metadata from Instagram."""
__version__ = '4.4.4rc1'
__version__ = '4.4.4rc3'
try:
+3 -14
View File
@@ -3,7 +3,6 @@
import ast
import datetime
import os
import platform
import re
import sys
from argparse import ArgumentParser, SUPPRESS
@@ -16,20 +15,10 @@ from .instaloader import get_default_session_filename
from .instaloadercontext import default_user_agent
def get_simple_argv0() -> str:
if platform.system() != "Windows":
argv0 = os.path.basename(sys.argv[0])
else:
dirname = os.path.relpath(os.path.dirname(sys.argv[0]))
basename = os.path.basename(sys.argv[0])
argv0 = os.path.join(dirname, basename)
argv0 = "instaloader" if argv0 == "__main__.py" else argv0
return argv0
def usage_string():
# NOTE: duplicated in README.rst and docs/index.rst
argv0 = get_simple_argv0()
argv0 = os.path.basename(sys.argv[0])
argv0 = "instaloader" if argv0 == "__main__.py" else argv0
return """
{0} [--comments] [--geotags]
{2:{1}} [--stories] [--highlights] [--tagged] [--igtv]
@@ -207,7 +196,7 @@ 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 ((profiles and download_profile_pic) or download_posts) and not instaloader.context.is_logged_in:
if profiles and (download_profile_pic or download_posts) and not instaloader.context.is_logged_in:
instaloader.context.error("Warning: Use --login to download higher-quality versions of pictures.")
instaloader.download_profiles(profiles,
download_profile_pic, download_posts, download_tagged, download_igtv,
+5 -2
View File
@@ -242,7 +242,9 @@ class Post:
"""URL of the picture / video thumbnail of the post"""
if self.typename == "GraphImage" and self._context.is_logged_in:
try:
return self._iphone_struct['image_versions2']['candidates'][0]['url']
orig_url = self._iphone_struct['image_versions2']['candidates'][0]['url']
url = re.sub(r'&se=\d+(&?)', r'\1', orig_url)
return url
except (InstaloaderException, KeyError, IndexError) as err:
self._context.error('{} Unable to fetch high quality image version of {}.'.format(err, self))
return self._node["display_url"] if "display_url" in self._node else self._node["display_src"]
@@ -266,7 +268,8 @@ class Post:
if not is_video and self._context.is_logged_in:
try:
carousel_media = self._iphone_struct['carousel_media']
display_url = carousel_media[idx]['image_versions2']['candidates'][0]['url']
orig_url = carousel_media[idx]['image_versions2']['candidates'][0]['url']
display_url = re.sub(r'&se=\d+(&?)', r'\1', orig_url)
except (InstaloaderException, KeyError, IndexError) as err:
self._context.error('{} Unable to fetch high quality image version of {}.'.format(err, self))
yield PostSidecarNode(is_video=is_video, display_url=display_url,