Reputation: 5
I've recently been trying to create a twitter bot, and one of my tests is posting a media file as a tweet. Unfortunately, I've ran into some roadblocks. I'll put the related code here:
filename = 'vid.mp4'
media = api.media_upload(filename, chunked=True, media_category="tweet_video")
client.create_tweet(text='test', media_ids=str(media.media_id))
The error I receive is:
tweepy.errors.BadRequest: 400 Bad Request $.media_ids: there must be a maximum of 4 items in the array
I'm a little lost here, honestly. I'm already having to use both v1.1 and v2 twitter because I only have an 'essentials' developer account currently, but it seems like this should work.
Any ideas?
Upvotes: 0
Views: 765
Reputation: 1843
According to the Tweepy documentation (here), media_ids
is supposed to be a list.
media = api.media_upload(filename, chunked=True, media_category="tweet_video")
media_ids = [media.media_id] # It can be a list of integers
client.create_tweet(text='test', media_ids=media_ids)
Upvotes: 1