subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.21k stars 667 forks source link

[BUG] ClipNotUpload (unkown) #1464

Open florifull opened 1 year ago

florifull commented 1 year ago

My program successfully scrapes reels, however when attempting to post them, I get ClipNotUpload Unknown messages, and nothing is posted to my Instagram account. I am using a residential proxy.

To Reproduce

from instagrapi import Client
from instagrapi.utils import json_value
from instagrapi.exceptions import (
    BadPassword, ReloginAttemptExceeded, ChallengeRequired,
    SelectContactPointRecoveryForm, RecaptchaChallengeForm,
    FeedbackRequired, PleaseWaitFewMinutes, LoginRequired, ClipNotUpload
)

def handle_exception(client, e):
    if isinstance(e, BadPassword):
        client.logger.exception(e)
        # client.set_proxy(self.next_proxy().href)
        if client.relogin_attempt > 0:
            # self.freeze(str(e), days=7)
            raise ReloginAttemptExceeded(e)
        # client.settings = self.rebuild_client_settings()
        # return self.update_client_settings(client.get_settings())
    elif isinstance(e, LoginRequired):
        client.logger.exception(e)
        client.relogin()
        # return self.update_client_settings(client.get_settings())
    elif isinstance(e, ChallengeRequired) or isinstance(e, ClipNotUpload):
        api_path = json_value(client.last_json, "challenge", "api_path")
        if api_path == "/challenge/":
            # client.set_proxy(self.next_proxy().href)
            # client.settings = self.rebuild_client_settings()
            pass
        else:
            try:
                client.challenge_resolve(client.last_json)
            except ChallengeRequired as e:
                # self.freeze('Manual Challenge Required', days=2)
                raise e
            except (ChallengeRequired, SelectContactPointRecoveryForm, RecaptchaChallengeForm) as e:
                # self.freeze(str(e), days=4)
                raise e
            # self.update_client_settings(client.get_settings())
        return True
    elif isinstance(e, FeedbackRequired):
        message = client.last_json["feedback_message"]
        if "This action was blocked. Please try again later" in message:
            # self.freeze(message, hours=12)
            print(message)
            # client.settings = self.rebuild_client_settings()
            # return self.update_client_settings(client.get_settings())
        elif "We restrict certain activity to protect our community" in message:
            # 6 hours is not enough
            # self.freeze(message, hours=12)
            print(message)
        elif "Your account has been temporarily blocked" in message:
            """
            Based on previous use of this feature, your account has been temporarily
            blocked from taking this action.
            This block will expire on 2020-03-27.
            """
            # self.freeze(message)
            print(message)
    elif isinstance(e, PleaseWaitFewMinutes):
        # self.freeze(str(e), hours=1)
        print(str(e))

    raise e

My handler exception:

api.challenge_code_handler = challenge_code_handler
api.change_password_handler = change_password_handler
api.handle_exception = handle_exception

Traceback Show your full traceback so that it is clear where exactly the error occurred.

" Analyzing CLIP file "/Users/alexskyh/Desktop/withpassword/downloads/10000000_1126119814850345_5130267384434702935_n.mp4" Generating thumbnail "/Users/alexskyh/Desktop/withpassword/downloads/10000000_1126119814850345_5130267384434702935_n.mp4.jpg"... Traceback (most recent call last): File "/Users/alexskyh/Desktop/withpassword/src/poster.py", line 50, in main media = api.clip_upload( ^^^^^^^^^^^^^^^^ File "/Users/alexskyh/.pyenv/versions/3.11.3/lib/python3.11/site-packages/instagrapi/mixins/clip.py", line 144, in clip_upload raise ClipNotUpload(response=self.last_response, self.last_json) instagrapi.exceptions.ClipNotUpload: Unknown ({'response': None}) Analyzing CLIP file "/Users/alexskyh/Desktop/withpassword/downloads/10000000_647767516849564_4189614808487813036_n.mp4" Generating thumbnail "/Users/alexskyh/Desktop/withpassword/downloads/10000000_647767516849564_4189614808487813036_n.mp4.jpg"... Traceback (most recent call last): File "/Users/alexskyh/Desktop/withpassword/src/poster.py", line 50, in main media = api.clip_upload( ^^^^^^^^^^^^^^^^ File "/Users/alexskyh/.pyenv/versions/3.11.3/lib/python3.11/site-packages/instagrapi/mixins/clip.py", line 144, in clip_upload raise ClipNotUpload(response=self.last_response, self.last_json) instagrapi.exceptions.ClipNotUpload: Unknown ({'response': None}) All reels are already posted.. "

Screenshot 2023-07-16 at 1 37 52 PM

Expected behavior Was supposed to upload reels. None were uploaded.

Info:

6ky commented 1 year ago

Show the actual code where this is being called please. Are all the necessary args passed?

NicoRulli commented 1 year ago

I'm having this issue too. Mine is saying clips.py error on line 144. Advice?

adw0rd commented 1 year ago

@NicoRulli "Show the actual code where this is being called please. Are all the necessary args passed?"

NicoRulli commented 1 year ago

Here is my code: // Mlpk = primary key for what to post m = cl.media_info(Mlpk) Download: if media_type == 2 and product_type == 'clips': p = cl.clip_download_by_url(m.video_url)

Upload: if media_type == 2 and product_type == 'clips': #Reel print('clip', p) cl.clip_upload(p, caption)

I get the same error as above. clips.py line 144

NicoRulli commented 1 year ago

Has this been resolved? Or is there an issue with clip.py for everyone?

adw0rd commented 1 year ago

@florifull I helped you in private messages, describe your resume here please