【问题标题】:How to use Instagram API in Python to upload images to my own account如何在 Python 中使用 Instagram API 将图像上传到我自己的帐户
【发布时间】:2020-04-04 07:30:56
【问题描述】:

我想创建一个脚本,我可以在其中自动将图像上传到我的 Instagram 帐户。我已经尝试过 3rd 方包(instapy-cli、InstagramAPI),但它们都不起作用。我已经注册了 Facebook 开发人员,但不知道如何在 Python 中使用它。

【问题讨论】:

    标签: python instagram-api


    【解决方案1】:

    使用 instabot python 库。以下函数采用用户名密码 image_path 和您的图像描述,以便将其发布到 Instagram。但是,您不能使用此代码发布多方/轮播帖子。

    from instabot import Bot
    import shutil
    import os
    
    def post(username, password , img , description):
        
        if os.path.exists('config'):
            shutil.rmtree('config')
    
        bot = Bot()
        bot.login(username = username, password = password)
        bot.upload_photo(img, caption = discription)
        os.rename(img+'.REMOVE_ME', img)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-22
      相关资源
      最近更新 更多