使用InstaBot模块将视频上载到Instagram

2024-05-28 18:51:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我目前正在开发一个机器人,它可以从我的谷歌照片上传一个随机媒体项目,并使用InstaBot和谷歌照片API将其上传到Instagram。上传图片没问题,但当尝试上传视频时,机器人会说

yolo.mp4 has successfully been uploaded 但当我去检查Instagram账户看它是否上传时,它就不起作用了。不确定问题是在InstaBot模块中还是在Google Photos API中。任何关于上传视频的帮助都会有所帮助

以下是处理视频文件的代码片段:

        elif holy_mimeType == 'video':
            audit_log.write(
                f'-------{feature3}-------\nUploaded Video from Google Photos at {datetime.datetime.time(datetime.datetime.now()).strftime("%H:%M:%S")} ({holy_productUrl})\n')

            download_file(holy_image+'=dv', r'.\ImageBin', "yolo.mp4")
            cap = f"""Hi! If this is the first time you are seeing these types of posts, read my bio for more info
                            This is an automatic account which uploads a media Item from @{other_user} 's Google Photos!


                            This Video was shot on: {feature3} GMT and had a 1 in {len(Base_URL_list)} Chance of being uploaded
                            ---- HASHTAGS ----
                            {base_hashtags}{daily_hashtags[today]}"""
            upload_video_to_instagram(r'.\ImageBin\yolo.mp4', cap)
            if os.path.isfile(r'.\ImageBin\yolo.mp4.REMOVE_ME'):
                os.remove(r'.\ImageBin\yolo.mp4.REMOVE_ME')

有关sniplet中使用的变量的一些信息:

1.holymimiType - From dataframe of all modia items and tells the type of media
2.audit_log - is a .txt file just so i can see which image is being uploaded afterwards with link
3.download_file is a function which downloads the file from URL

Tags: ofthefromwhichdatetimeisgoogle机器人

热门问题