ohld / igbot

🐙 Free scripts, bots and Python API wrapper. Get free followers with our auto like, auto follow and other scripts!
https://hikerapi.com/p/N2P6iqiM
Apache License 2.0
4.72k stars 1.47k forks source link

Can't Post Video #1110

Closed Lem0nTree closed 4 years ago

Lem0nTree commented 5 years ago

Please follow the guide below


Before submitting an issue, make sure you have:

Purpose of your issue?

For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.

Paste the output of python -V here: Python 3.7.5

# Example code that will produce the error reported
from __future__ import unicode_literals

import argparse
import os
import sys

import captions_for_medias

sys.path.append(os.path.join(sys.path[0], "../../"))
from instabot import Bot  # noqa: E402

parser = argparse.ArgumentParser(add_help=True)
parser.add_argument("-u", type=str, help="username")
parser.add_argument("-p", type=str, help="password")
parser.add_argument("-proxy", type=str, help="proxy")
parser.add_argument("-video", type=str, help="video name")
parser.add_argument("-caption", type=str, help="caption for video")
args = parser.parse_args()

args.u = "###"
args.p = "###"

bot = Bot()
bot.login(username=args.u, password=args.p,)

posted_video_file = "videos.txt"

posted_video_list = []
caption = ""

if not os.path.isfile(posted_video_file):
    with open(posted_video_file, "w"):
        pass
else:
    with open(posted_video_file, "r") as f:
        posted_video_list = f.read().splitlines()

# Get the filenames of the videos in the path ->
if not args.video:
    import glob

    videos = []
    exts = ["mp4", "MP4", "mov", "MOV"]
    for ext in exts:
        videos += [os.path.basename(x) for x in glob.glob("media/*.{}".format(
            ext
        ))]
    from random import shuffle

    shuffle(videos)
else:
    videos = [args.video]
videos = list(set(videos) - set(posted_video_list))
if len(videos) == 0:
    if not args.video:
        bot.logger.warning("NO MORE VIDEO TO UPLOAD")
        exit()
    else:
        bot.logger.error("The video `{}` has already been posted".format(
            videos[0]
        ))
try:
    for video in videos:
        bot.logger.info("Checking {}".format(video))
        if args.caption:
            caption = args.caption
        else:
            if captions_for_medias.CAPTIONS.get(video):
                caption = captions_for_medias.CAPTIONS[video]
            else:
                try:
                    caption = raw_input(
                        "No caption found for this media. "
                        "Type the caption now: "
                    )
                except NameError:
                    caption = input(
                        "No caption found for this media. "
                        "Type the caption now: "
                    )
        bot.logger.info(
            "Uploading video `{video}` with caption: `{caption}`".format(
                video=video, caption=caption
            )
        )
        if not bot.upload_video(
            os.path.dirname(os.path.realpath(__file__)) + "/media/" + video,
            caption=caption,
        ):
            bot.logger.error("Something went wrong...")
            break
        posted_video_list.append(video)
        with open(posted_video_file, "a") as f:
            f.write(video + "\n")
        bot.logger.info("Succesfully uploaded: " + video)
        break
except Exception as e:
    bot.logger.error("\033[41mERROR...\033[0m")
    bot.logger.error(str(e))

Error/Debug Log:

2019-10-29 17:54:18,672 - INFO - Video 'C:\Users\loren\Desktop\tiktok\instabot-master\examples\video/media/60s.mp4' is not uploaded .
2019-10-29 17:54:18,673 - ERROR - Something went wrong...
2019-10-29 17:54:18,679 - INFO - Total requests: 73

Describe your issue

Yesterday it all worked like hell, today to test in it was my fault or not, i made a fresh installation of instabot, and runned the example file upload_video.py, and it still give me error. I read on another bot that instagram has updated its API, so maybe this error is due to this.

adw0rd commented 4 years ago

Hello everyone, I figured out the situation and was able to upload the video via /rupload_igvideo/ endpoint, this week I will try to implement a new upload_video for instabot

bruvv commented 4 years ago

Glad it got fixed! Closing :)