subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.38k stars 685 forks source link

[BUG] login required for story_download_by_url #381

Closed adw0rd closed 3 years ago

adw0rd commented 3 years ago
cl = Client()
cl.login(USERNAME, PASSWORD)
cl.story_download_by_url("https://www.instagram.com/stories/psg/2668312627606420472/?hl=en")
...
~/i/instagrapi/mixins/story.py in story_download_by_url(self, url, filename, folder)
    280         path = Path(folder) / filename
    281         response = requests.get(url, stream=True)
--> 282         response.raise_for_status()
    283         with open(path, "wb") as f:
    284             response.raw.decode_content = True

~/i/.venv/lib/python3.8/site-packages/requests/models.py in raise_for_status(self)
    951
    952         if http_error_msg:
--> 953             raise HTTPError(http_error_msg, response=self)
    954
    955     def close(self):

HTTPError: 429 Client Error: Too Many Requests for url: https://www.instagram.com/accounts/login/
adw0rd commented 3 years ago

@JulienMaille you incorrectly use the story_download_by_url function

I added an example to the documentation and an additional assert that will warn that the function is not being used correctly

cl.story_download(
    cl.story_pk_from_url('https://www.instagram.com/stories/adw0rd/2581281926631793076/')
)
PosixPath('/app/189361307_229642088942817_9180243596650100310_n.mp4')
JulienMaille commented 3 years ago

@adw0rd are you sure you wanted to mention me?

adw0rd commented 3 years ago

@adw0rd are you sure you wanted to mention me?

sorry i was wrong