Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Automate social media posts

The background

A part of our workflow at Abandoned Hope is:

  1. Post YouTube video with custom thumbnail, video title and description
  2. Share this on all social media (Twitter, Facebook and IGTV) manually

This takes our certain time which can be automated without errors which we often commit while copy pasting cross platforms. This inspired me to write this script to automate (at least) Twitter's part for now.

How this works

Using YouTube's API calls, this will fetch metadata from the latest video including video title, high-res thumbnail and the description and post a tweet with a picture and link to YouTube's video. In our videos, we separate the last line of the video description as the hashtags (as most of us) making it easier to scrape them using regex: hashtags = re.split("\n", description)[-1]


  1. Google developer account with API keys
  2. Twitter developer account with API keys


  1. The Google APIs Client Library for Python:
pip install --upgrade google-api-python-client
pip install --upgrade google-auth-oauthlib google-auth-httplib2
  1. Tweepy API for twitter:
pip install tweepy
  1. Clone this repo:
git clone
  1. Rename config.sample.json to config.json
  2. Update config.json with your developer keys from Twitter and YouTube:
    "youtube_API_key": "XXXX",
    "twitter_API_Key": "XXXX",
    "twitter_secret_key": "XXXX",
    "twitter_bearer_token": "XXXX",
    "twitter_access_token": "XXXX",
    "twitter_access_token_secret": "XXXX"
  1. Run python to post thumbail image from your latest video


If you run into this error: AttributeError: 'Http' object has no attribute 'http' , refer to the solution here:

Customize tweet

Replace this section from to what fits your use-case and Twitter's character count:

# Custom status message
status = f"{title}\n\nNew Video out now! \n\n {video_url} \n\n {hashtags}"


Sample Tweet

Missing Info / Bugs

  • 😰 Something broken? Open an issue with additional context and I'll try to fix it. Screenshots help!

  • More additional services/use-cases, open a new issue


Automate tweeting after posting new YouTube video




No releases published


No packages published