Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Instabot:是否可以在一篇文章中上载多个图像?_Python - Fatal编程技术网

Python Instabot:是否可以在一篇文章中上载多个图像?

Python Instabot:是否可以在一篇文章中上载多个图像?,python,Python,我正在使用这段代码为Instagram创建一个简单的daily post机器人 一切都进行得很顺利,但如果我能在每篇文章中发布2-3张图片的专辑,那将是难以置信的 这可能吗 这是我到目前为止所做的,非常适合于单张图片的帖子 import os import random import shutil import time import schedule from PIL import Image from instabot import Bot def get_image_and_post(

我正在使用这段代码为Instagram创建一个简单的daily post机器人

一切都进行得很顺利,但如果我能在每篇文章中发布2-3张图片的专辑,那将是难以置信的

这可能吗

这是我到目前为止所做的,非常适合于单张图片的帖子

import os
import random
import shutil
import time
import schedule

from PIL import Image
from instabot import Bot

def get_image_and_post():
path = r"……………"
file_name = random.choice([x for x in os.listdir(path) if not x.startswith(".")])
fullpath = path + "/" + file_name
img = Image.open(fullpath)
img.save(file_name)

destination = "…………"
shutil.move(fullpath, destination)
os.remove(destination + '/' + file_name)

title_caption = file_name.replace("-", " ") \
.replace(".jpeg", "") \
.replace(".jpg", "")

my_hashtags = "……………"
caption_final = title_caption + "\n.\n.\n.\n.\n.\n" + my_hashtags

bot = Bot()
bot.login(username="…………", password="…………")
bot.upload_photo("…………" + file_name, caption=caption_final)

print(caption_final + " ————> Posted!")
我只是想知道这是否有可能?我找不到别的地方问这个问题


提前谢谢你

我不认为使用instaBot可以做到这一点,但我通过使用instagrapi成功做到了这一点

来自instagrapi导入客户端
bot=Client()
bot.login(用户名、密码)
相册路径=[“../Image1.jpg”、“../Image2.jpg”]
text=“你好”
bot.album_上传(
小径,
标题=文本
)

干得好!我现在也在做同样的工作。我想知道您是否找到了一种方法来区分图像是水平的还是垂直的,将其上传到正确的方向。谢谢