mirror of
https://github.com/instaloader/instaloader.git
synced 2026-11-01 21:15:29 -08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1567a0342 | ||
|
|
610b6242a0 | ||
|
|
d90f90988a |
@@ -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.4.4rc1'
|
__version__ = '4.4.4rc2'
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
+2
-12
@@ -16,20 +16,10 @@ from .instaloader import get_default_session_filename
|
|||||||
from .instaloadercontext import default_user_agent
|
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():
|
def usage_string():
|
||||||
# NOTE: duplicated in README.rst and docs/index.rst
|
# 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 """
|
return """
|
||||||
{0} [--comments] [--geotags]
|
{0} [--comments] [--geotags]
|
||||||
{2:{1}} [--stories] [--highlights] [--tagged] [--igtv]
|
{2:{1}} [--stories] [--highlights] [--tagged] [--igtv]
|
||||||
|
|||||||
@@ -242,7 +242,9 @@ class Post:
|
|||||||
"""URL of the picture / video thumbnail of the post"""
|
"""URL of the picture / video thumbnail of the post"""
|
||||||
if self.typename == "GraphImage" and self._context.is_logged_in:
|
if self.typename == "GraphImage" and self._context.is_logged_in:
|
||||||
try:
|
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:
|
except (InstaloaderException, KeyError, IndexError) as err:
|
||||||
self._context.error('{} Unable to fetch high quality image version of {}.'.format(err, self))
|
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"]
|
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:
|
if not is_video and self._context.is_logged_in:
|
||||||
try:
|
try:
|
||||||
carousel_media = self._iphone_struct['carousel_media']
|
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:
|
except (InstaloaderException, KeyError, IndexError) as err:
|
||||||
self._context.error('{} Unable to fetch high quality image version of {}.'.format(err, self))
|
self._context.error('{} Unable to fetch high quality image version of {}.'.format(err, self))
|
||||||
yield PostSidecarNode(is_video=is_video, display_url=display_url,
|
yield PostSidecarNode(is_video=is_video, display_url=display_url,
|
||||||
|
|||||||
Reference in New Issue
Block a user