使用 Python 自动化 Instagram 消息2024年8月29日 | 阅读时长18分钟 在本文中,我们将使用Python自动化Instagram消息的发送操作。首先,让我们看看什么是Instagram。 Instagram是一个专注于照片和视频分享的著名社交媒体平台。它自2010年开始运营,并引入了Instagram快拍、购物、Instagram短视频等创新功能,保持了其吸引力。Instagram是一个由Kevin Systrom和Mike Krieger于2010年创建,后来被Facebook Inc.收购的图片和视频分享社交网站。用户可以上传照片和视频,并使用话题标签和地理标签进行过滤和分组。帖子可以与公众分享,也可以只与预先批准的关注者分享。用户可以通过标签和位置浏览他人的内容,查看热门内容,点赞照片,并关注他人以将他们的内容添加到自己的个人动态中。 2015年分辨率升级到1080像素后,这一限制被取消。它还包括了消息功能,在一个帖子中分享多张照片或视频的能力,以及一个类似于Snapchat的快拍功能,允许用户在24小时内可供他人访问的时间顺序动态中发布内容。截至2019年1月,每天有5亿人使用快拍。Instagram于2012年被Facebook收购,现在拥有超过10亿用户,已深入人们的生活。 Instagram最初的特点是只允许内容以640像素的方形(1:1)宽高比呈现,这与当时iPhone的宽度相对应。 Instagram是一个个人和企业都可以使用的平台。公司可以通过创建免费的企业账户来利用照片分享应用程序推广其品牌和产品。拥有企业账户的企业可以获得免费的参与度和曝光度分析。根据Instagram的网站,超过100万营销人员使用该平台分享他们的故事并实现商业目标。此外,60%的用户报告说该应用程序帮助他们发现新产品。 现在让我们来看看代码 代码 输出 from the listed below the list of operations select any one of the operations: 1. To provide the credentials(username/password) to log in to the website. 2. To provide the list of usernames of the users to whom to send the messages. 3. To provide the list of messages that will be sent to specified users. 4. To log in to the website and navigate to the homepage of the website. 5. To type messages for all the users and send those typed messages. 6. To exit from the code execution. 1 Enter the username to login to https://www.instagram.com/ user_name_demo Enter the password to login to https://www.instagram.com/ P@ssw0rd To move forward with the code, enter either [y] or [n] to halt y from the listed below the list of operations select any one of the operations: 1. To provide the credentials(username/password) to login into the website. 2. To provide the list of usernames of the users to whom to send the messages. 3. To provide the list of messages that will be sent to specified users. 4. To log in to the website and navigate to the homepage of the website. 5. To type messages for all the users and send those typed messages. 6. To exit from the code execution. 2 Enter the number of users to whom you want to send messages to 3 Enter the username of user 1 target_user_1 Enter the username of user 2 target_user_2 Enter the username of user 3 target_user_3 To move forward with the code, enter either [y] or [n] to halt y from the listed below the list of operations select any one of the operations: 1. To provide the credentials(username/password) to log in to the website. 2. To provide the list of usernames of the users to whom to send the messages. 3. To provide the list of messages that will be sent to specified users. 4. To log in to the website and navigate to the homepage of the website. 5. To type messages for all the users and send those typed messages. 6. To exit from the code execution. 3 Enter the message for the user with username target_user_1 Hi, this is a message for user1. Enter the message for the user with username target_user_2 Hope you get this message. Enter the message for the user with username target_user_3 User3 this message for you. To move forward with the code, enter either [y] or [n] to halt y from the listed below the list of operations select any one of the operations: 1. To provide the credentials(username/password) to log in to the website. 2. To provide the list of usernames of the users to whom to send the messages. 3. To provide the list of messages that will be sent to specified users. 4. To log in to the website and navigate to the homepage of the website. 5. To type messages for all the users and send those typed messages. 6. To exit from the code execution. 4 Logged In Successfully and navigated to the homepage. To move forward with the code, enter either [y] or [n] to halt y from the listed below the list of operations select any one of the operations: 1. To provide the credentials(username/password) to log in to the website. 2. To provide the list of usernames of the users to whom to send the messages. 3. To provide the list of messages that will be sent to specified users. 4. To login to the website and navigate to the homepage of the website. 5. To type messages for all the users and send those typed messages. 6. To exit from the code execution. 5 [target_user_1] message sent to [Hi this is message for user1.] successfully. [target_user_2] message sent to [Hope you get this message.] successfully. [target_user_3] message sent to [User3 this message for you.] successfully. Messages were sent successfully. To move forward with the code, enter either [y] or [n] to halt y from the listed below the list of operations select any one of the operations: 1. To provide the credentials(username/password) to log in to the website. 2. To provide the list of usernames of the users to whom to send the messages. 3. To provide the list of messages that will be sent to specified users. 4. To log in to the website and navigate to the homepage of the website. 5. To type messages for all the users and send those typed messages. 6. To exit from the code execution. 2 Enter the number of users to whom you want to send messages to 1 Enter the username of user 1 Ronaldo. Chris To move forward with the code, enter either [y] or [n] to halt y from the listed below the list of operations select any one of the operations: 1. To provide the credentials(username/password) to log in to the website. 2. To provide the list of usernames of the users to whom to send the messages. 3. To provide the list of messages that will be sent to specified users. 4. To log in to the website and navigate to the homepage of the website. 5. To type messages for all the users and send those typed messages. 6. To exit from the code execution. 3 Enter the message for the user with the username Ronaldo.Chris Hi, I'm a big fan of your game. To move forward with the code, enter either [y] or [n] to halt y from the listed below the list of operations select any one of the operations: 1. To provide the credentials(username/password) to log in to the website. 2. To provide the list of usernames of the users to whom to send the messages. 3. To provide the list of messages that will be sent to specified users. 4. To log in to the website and navigate to the homepage of the website. 5. To type messages for all the users and send those typed messages. 6. To exit from the code execution. 5 [ronaldo. cris] message sent to [Hi I'm a big fan of your game.] successfully. Messages were sent successfully. To move forward with the code, enter either [y] or [n] to halt y from the listed below the list of operations select any one of the operations: 1. To provide the credentials(username/password) to log in to the website. 2. To provide the list of usernames of the users to whom to send the messages. 3. To provide the list of messages that will be sent to specified users. 4. To log in to the website and navigate to the homepage of the website. 5. To type messages for all the users and send those typed messages. 6. To exit from the code execution. 6 说明 在上面编写的代码中,正如我们在输出中看到的那样,主函数中创建了一个上面编写的类的对象,并且这个创建的对象用于调用上面类中编写的所有不同函数,程序的顺序是这样的:用户会获得一个选项列表供选择,用户可以从列表中选择任何操作,列表中提供的操作例如提供凭据登录网站、提供用户希望发送消息的用户名列表、提供需要发送给前一步骤中提供的用户名的消息列表,在提供所有必需的输入后,用户可以选择登录功能并导航到主页,在成功进行身份验证和登录网站后,用户然后选择输入并发送消息的选项,此选项将调用我们类中编写的主函数,该函数将实际执行在第二步中提供的用户名的相应聊天框中输入消息的操作,并且相应的消息被输入到该用户的聊天框中,然后点击发送按钮将该消息发送给目标用户,此过程将为用户在前面步骤中提供的用户名列表中的所有用户重复执行。 自动化的优势
自动化的缺点
因此,在本文中,我们已经了解了如何使用 Python 自动化发送 Instagram 消息的过程。 |
我们请求您订阅我们的新闻通讯以获取最新更新。