Notes:
-
Problem: Posting Instagram Stories manually takes time.
-
Benefit: Automates story uploads at scheduled times.
-
Adoption: Extend with AI-generated story content.
Python Code:
from selenium import webdriver
import time
def upload_story(username, password, image_path):
driver = webdriver.Chrome()
driver.get("https://www.instagram.com/accounts/login/")
time.sleep(2)
driver.find_element("name", "username").send_keys(username)
driver.find_element("name", "password").send_keys(password + Keys.RETURN)
time.sleep(5)
driver.get("https://www.instagram.com/stories/create/")
time.sleep(3)
upload_input = driver.find_element("xpath", "//input[@type='file']")
upload_input.send_keys(image_path)
time.sleep(2)
post_button = driver.find_element("xpath", "//button[contains(text(),'Share')]")
post_button.click()
time.sleep(2)
driver.quit()
if __name__ == "__main__":
upload_story("your_username", "your_password", "/path/to/image.jpg")
No comments:
Post a Comment