diff --git a/README.rst b/README.rst index 0f423cf..b967ab6 100644 --- a/README.rst +++ b/README.rst @@ -2,11 +2,7 @@ .. badges-start -|travis| |pypi| |pyversion| |license| |aur| |contributors| |downloads| - -.. |travis| image:: https://img.shields.io/travis/instaloader/instaloader/master.svg - :alt: Travis-CI Build Status - :target: https://travis-ci.org/instaloader/instaloader +|pypi| |pyversion| |license| |aur| |contributors| |downloads| .. |pypi| image:: https://img.shields.io/pypi/v/instaloader.svg :alt: Instaloader PyPI Project Page diff --git a/instaloader/__init__.py b/instaloader/__init__.py index dbbb5a6..4058024 100644 --- a/instaloader/__init__.py +++ b/instaloader/__init__.py @@ -1,7 +1,7 @@ """Download pictures (or videos) along with their captions and other metadata from Instagram.""" -__version__ = '4.9.5' +__version__ = '4.10a1' try: diff --git a/instaloader/instaloadercontext.py b/instaloader/instaloadercontext.py index 00681bb..5d9ed04 100644 --- a/instaloader/instaloadercontext.py +++ b/instaloader/instaloadercontext.py @@ -378,11 +378,12 @@ class InstaloaderContext: while resp.is_redirect: redirect_url = resp.headers['location'] self.log('\nHTTP redirect from https://{0}/{1} to {2}'.format(host, path, redirect_url)) - if redirect_url.startswith('https://www.instagram.com/accounts/login'): + if (redirect_url.startswith('https://www.instagram.com/accounts/login') or + redirect_url.startswith('https://i.instagram.com/accounts/login')): if not self.is_logged_in: raise LoginRequiredException("Redirected to login page. Use --login.") - # alternate rate limit exceeded behavior - raise TooManyRequestsException("Redirected to login") + raise AbortDownloadException("Redirected to login page. You've been logged out, please wait " + + "some time, recreate the session and try again") if redirect_url.startswith('https://{}/'.format(host)): resp = sess.get(redirect_url if redirect_url.endswith('/') else redirect_url + '/', params=params, allow_redirects=False) diff --git a/instaloader/sectioniterator.py b/instaloader/sectioniterator.py index 77816f2..b16f4dc 100644 --- a/instaloader/sectioniterator.py +++ b/instaloader/sectioniterator.py @@ -29,7 +29,7 @@ class SectionIterator(Iterator[T]): def _query(self, max_id: Optional[str] = None) -> Dict[str, Any]: pagination_variables = {"max_id": max_id} if max_id is not None else {} return self._sections_extractor( - self._context.get_json(self._query_path, params={"__a": 1, **pagination_variables}) + self._context.get_json(self._query_path, params={"__a": 1, "__d": "dis", **pagination_variables}) ) def __next__(self) -> T: diff --git a/instaloader/structures.py b/instaloader/structures.py index aacf58b..e4b8f0a 100644 --- a/instaloader/structures.py +++ b/instaloader/structures.py @@ -671,7 +671,7 @@ class Post: location_id = int(loc['id']) if any(k not in loc for k in ('name', 'slug', 'has_public_page', 'lat', 'lng')): loc.update(self._context.get_json("explore/locations/{0}/".format(location_id), - params={'__a': 1})['native_location_data']['location_info']) + params={'__a': 1, '__d': 'dis'})['native_location_data']['location_info']) self._location = PostLocation(location_id, loc['name'], loc['slug'], loc['has_public_page'], loc.get('lat'), loc.get('lng')) return self._location