twikit icon indicating copy to clipboard operation
twikit copied to clipboard

When trying to create a tweet and adding a video to the tweet, it prompts: Error code 324

Open aini1123x opened this issue 1 year ago • 1 comments

status = client.check_media_status("1788113005861027840") print(status ) client.create_tweet(text="i love musk",media_ids="1788113005861027840") print("okay")

Run Result:

{'media_id': 1788113005861027840, 'media_id_string': '1788113005861027840', 'media_key': '7_1788113005861027840', 'size': 974522, 'expires_after_secs': 85576, 'video': {'video_type': 'video/mp4'}, 'processing_info': {'state': 'succeeded', 'progress_percent': 100}} Traceback (most recent call last): File "C:\Users\山谷\PycharmProjects\pythonProject\定时.py", line 63, in client.create_tweet(text="i love musk",media_ids="1788113005861027840") File "C:\Users\山谷\PycharmProjects\pythonProject.venv\Lib\site-packages\twikit\client.py", line 1121, in create_tweet raise_exceptions_from_response(response['errors']) File "C:\Users\山谷\PycharmProjects\pythonProject.venv\Lib\site-packages\twikit\errors.py", line 100, in raise_exceptions_from_response raise exception(error['message']) twikit.errors.InvalidMedia: BadRequest: Tweet must not have more than 4 mediaIds. (324)

I actually only uploaded one video file, not more than four

aini1123x avatar May 08 '24 08:05 aini1123x

@aini1123x Pass media_ids as a list, not as a string.

client.create_tweet(text="i love musk",media_ids=["1788113005861027840"])

d60 avatar May 17 '24 15:05 d60