1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-11-04 09:22:29 +01:00

Fix downloading (set max_id only if not zero)

This should fix #17.
This commit is contained in:
Alexander Graf 2017-02-13 09:50:20 +01:00
parent 6e3c13b5d3
commit 02509d3c40

View File

@ -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)