paint-brush
Youtube To Anchor.fm - A Github Action To Automatically Publish Your Podcastby@thejoin95
1,388 reads
1,388 reads

Youtube To Anchor.fm - A Github Action To Automatically Publish Your Podcast

by Miki LombardiSeptember 7th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

A Github Action To Automatically Publish Your Podcast is available on the Github Action Marketplace. This action will upload an audio file from a given youtube video automatically to your Anchor.fm account. It is available for free, it is open source under MIT license. The action will start everytime you push a change on the episode.json file. It is an open source project, feel free to contribute. The action is using a Docker image built over ubuntu 18.04. It take some times to setup the environment.

Company Mentioned

Mention Thumbnail
featured image - Youtube To Anchor.fm - A Github Action To Automatically Publish Your Podcast
Miki Lombardi HackerNoon profile picture

During the quarantine period, I started an Italian tech live show on YouTube and a podcast on Spotify and Anchor.fm with some of my friends. The show’s called Schrödinger Hat.

We are enjoying a lot creating these content over the web, but we encounter some technical issues. Some of them were minor issues that we managed very well during the time, but then… there was the major issue.


The issue

We encounter some problem by uploading the audio file from YouTube to Anchor.fm, because this action is required time, a converion tool and… you know, in the 2020 no one has too much time.

We started thinking. We searched for some Anchor.fm APIs, but we found none… until this conversation happen:

- “Should we create a private Anchor.fm API?”
- “Uhm… I heard something about Github Actions, maybe we can automate the whole process by using it”
- “Shut up and let’s start coding.”


The solution

We are managing the whole podcast project trough Github and with the Github Actions you can automate, customize, and execute your software development workflows right in your repository!

We developed a Github Action, available on the Github Action Marketplace, that automate the whole publishing process to from YouTube to Anchor.fm.

Schrodinger-Hat/youtube-to-anchorfm
This action will upload an audio file from a given youtube video automatically to your Anchor.fm account. It is very…github.com

The workflow and the action is available for free, it is open source under MIT license.


How it works

The Github Action is using youtube-dl library and puppeteer.

The first one is a npm module used for donwloading the video / audio from YouTube, meanwhile Puppeteer will upload the generated file into the Anchor.fm dashboard (by loggin it).

The action will start everytime you push a change on the episode.json file. Into this file you need to specify the youtube id of your video.

The action use a Docker image built over ubuntu 18.04. It take some times to setup the environment (installing dependecies and chromium browser).


How can I use it?

You can use the latest version of this action from the Github Action Marketplace.

In your repository root directory you should add a episode.json file containing your youtube video id, e.g:

{
  "id": "nHCXZC2InAA"
}

Then you can add under the .github/workflows directory this yml:

name: 'Upload Episode from YouTube To Anchor.Fm'
on:
  push:
    paths: 
      - episode.json
    branches: [master]
jobs:
  upload_episode:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Upload Episode from YouTube To Anchor.Fm
        uses: Schrodinger-Hat/[email protected]
        env:
          ANCHOR_EMAIL: ${{ secrets.ANCHOR_EMAIL }}
          ANCHOR_PASSWORD: ${{ secrets.ANCHOR_PASSWORD }}


NOTE: you need to set up the secrets for ANCHOR_EMAIL and ANCHOR_PASSWORD. This environment variables are mandatory as they specify the signin account.

A little workflow explanation

The above workflow is saying:

every time you push some changes on the episode.json file, it will setup the “YouTube to Anchor.fm” action with your Anchor.fm account (specify in your secrets) that will download the YouTube video specified, convert it into an audio file (best quality) and upload it into your Anchor.fm account

Conclusion

We enjoyed a lot building this action on Github Actions and it saves us a tons of time.

We are hoping that will help other creators that are using the same platform.
I will suggest to Anchor.fm to make some public API to permit to the developers to push the audio file and managing the whole publishing process better.


Contributing

It is an open source project, feel free to contribute.
Also a feedback, any kind of it, it is really appreciated.