large-video-upload-python icon indicating copy to clipboard operation
large-video-upload-python copied to clipboard

How do you post a tweet thread using this?

Open a3igner opened this issue 5 years ago • 1 comments

Hi Uploading a video works! How could i post an attached tweet to the tweet i uploaded a video for to make a thread? Thanks!

a3igner avatar Jun 25 '20 07:06 a3igner

Just adding another status update thingy in tweet(self):

def tweet(self):
    '''
    Publishes Tweet with attached video
    '''
    request_data = {
      'status': 'I just uploaded a video with the @TwitterAPI.',
      'media_ids': self.media_id
    }

    req = requests.post(url=POST_TWEET_URL, data=request_data, auth=oauth)
    print(req.json())
    
    thread_data = {
        'status': 'This tweet will be in reply to the video i just uploaded',
        'in_reply_to_status_id': req.json()['id'],
        'auto_populate_reply_metadata': True
    }

    req2 = requests.post(url=POST_TWEET_URL, data=thread_data, auth=oauth)
    print(req2.json())

Should work, I believe?

pigeonburger avatar Jan 13 '21 10:01 pigeonburger