From fe5648ed115de119bab349911dcb75447f8de66a Mon Sep 17 00:00:00 2001 From: Gabe Date: Sun, 1 Dec 2024 11:54:24 -0800 Subject: [PATCH] Added feature that let's users start a live-broadcast and get the stream_{url, key} --- instagrapi/mixins/media.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/instagrapi/mixins/media.py b/instagrapi/mixins/media.py index f52d1f41..a63f74e3 100644 --- a/instagrapi/mixins/media.py +++ b/instagrapi/mixins/media.py @@ -1153,3 +1153,21 @@ def media_unpin(self, media_pk): A boolean value """ return self.media_pin(media_pk, True) + + def media_schedule_livestream(self, title, auto_start=False): + data = { + "broadcast_message": title, + "internal_only": "false", + "source_type": "203", + "visibility": "0" + } + result = self.private_request("live/create/", data) + broadcast_id = result['broadcast_id'] + if auto_start: + startRes = self.media_start_livestream(broadcast_id) + print(startRes) + return result + + def media_start_livestream(self, broadcast_id): + result = self.private_request(f"live/{broadcast_id}/start/", {'empty': None}) + return result["status"] == "ok"