Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
upload-cloud

GitHub Action

Upload Episode from YouTube To Anchor.Fm

v1.0.3

Upload Episode from YouTube To Anchor.Fm

upload-cloud

Upload Episode from YouTube To Anchor.Fm

An automation tool to publish your podcast from youtube to anchor.fm

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Upload Episode from YouTube To Anchor.Fm

uses: Schroedinger-Hat/[email protected]

Learn more about this action in Schroedinger-Hat/youtube-to-anchorfm

Choose a version

Youtube to Anchor.fm - An automation tool to publish your podcast

Cover image

This action will upload an audio file from a given youtube video automatically to your Anchor.fm account.

It is very useful in a scenario where you have a YouTube account and also a podcast over Spotify, Anchor.fm, Play Music, iTunes etc.

In our live show (Schrodinger Hat) we had this necessity. So we built it for the open source community.

Every contribution it is appreciated, also a simple feedback.

How it works

The workflow 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 Actions 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: [main]

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 }}
          EPISODE_PATH: /github/workspace

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.

Process a YouTube playlist

Right now, you can process a full playlist (one way only) with

curl https://scc-youtube.vercel.app/playlist-items/PLoXdlLuaGN8ShASxcE2A4YuSto3AblDmX \
    | jq '.[].contentDetails.videoId' -r \
    | tac \
    | xargs -I% bash -c "jo id='%' > episode.json && git commit -am % && git push"

https://scc-youtube.vercel.app/playlist-items is from https://github.com/ThatGuySam/youtube-json-server

jo is a json generator https://github.com/jpmens/jo

tac is a command present in most linuxes and on mac with brew install coreutils. Its from reversing the list from older to newer. Remove if you want to upload in the order presented on youtube.

jq is a json processor https://stedolan.github.io/jq/

This must be run on the folder where your episode.json is.

Draft Mode

By setting the SAVE_AS_DRAFT, the new episode will be published as a draft. This can be useful if you need someone else's approval before actual publication.

env:
   SAVE_AS_DRAFT: true

Audio conversion options

ffmpeg is used to convert the video to MP3. It's possible to pass arguments to ffmpeg with POSTPROCESSOR_ARGS enviroment variable.

See -postprocessor-args syntax and options on https://github.com/yt-dlp/yt-dlp#post-processing-options.

The example below convert the video to mono audio.

env:
   POSTPROCESSOR_ARGS: "ffmpeg:-ac 1"

Explicit Mode

By setting the IS_EXPLICIT, the new episode will be marked as explicit.

env:
   IS_EXPLICIT: true

Thumbnail Mode

By setting the LOAD_THUMBNAIL, the new episode will include the video thumbnail as the episode art.

env:
   LOAD_THUMBNAIL: true

Credits

@thejoin & @wabri

License

MIT