From 02509d3c406f3ac140136e2a7ec1e6793fb4b7d1 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 13 Feb 2017 09:50:20 +0100 Subject: [PATCH] Fix downloading (set max_id only if not zero) This should fix #17. --- instaloader.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/instaloader.py b/instaloader.py index af4ecca..1165ad4 100755 --- a/instaloader.py +++ b/instaloader.py @@ -63,8 +63,10 @@ def _log(*msg, sep='', end='\n', flush=False, quiet=False): def get_json(name: str, session: requests.Session, max_id: int = 0, sleep: bool = True) -> Optional[Dict[str, Any]]: """Return JSON of a profile""" - resp = session.get('http://www.instagram.com/'+name, - params={'max_id': max_id}) + if max_id == 0: + resp = session.get('https://www.instagram.com/'+name) + else: + resp = session.get('https://www.instagram.com/'+name, params={'max_id': max_id}) if sleep: time.sleep(4 * random.random() + 1) match = re.search('window\\._sharedData = .*<', resp.text)