YouTube to Anchor.fm – An Automation Tool to Publish Your Podcast

Jan 31, 2024 | Programming

Welcome to the future of podcasting automation! If you have a YouTube account and a podcast on Spotify via Anchor.fm, you are in the right place. This tool uploads audio files from your favorite YouTube videos directly to your Anchor.fm account. In our live show, Schrodinger Hat, we encountered this need, and thus, we built this solution for the open-source community.

How It Works

Imagine you are a chef who prepares delicious meals for your restaurant. The kitchen is your YouTube channel where you cook your popular dishes, and the dining area is your podcast on Anchor.fm where guests savor those same meals. This automation tool serves as the waiter who swiftly transports your culinary creations from the kitchen directly to the dining area—making sure your patrons enjoy the sound of your culinary magic without a delay.

Every time you push an update to an episode.json file containing the YouTube ID of your videos, the automation starts. It utilizes a Docker container set up over Ubuntu to ensure everything is cooked perfectly!

**Note:** For the script to run successfully, make sure you have at least one episode manually published on your Anchor.fm account. This step is crucial because the initial setup for new accounts differs from established accounts.

How Can I Run This as a GitHub Action?

Ready to automate? Follow these steps:

  • Get the latest version of this action from the GitHub Actions marketplace.
  • Create an episode.json file in your repository’s root directory with your YouTube video id. Here’s an example:
  • {
      "id": "nHCXZC2InAA"
    }
  • Next, set up your GitHub action in the .github/workflows directory using the following YAML:
  • 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/youtube-to-anchorfm@v2.5.0
            env:
              ANCHOR_EMAIL: ${{ secrets.ANCHOR_EMAIL }}
              ANCHOR_PASSWORD: ${{ secrets.ANCHOR_PASSWORD }}
              SPOTIFY_EMAIL: ${{ secrets.SPOTIFY_EMAIL }}
              SPOTIFY_PASSWORD: ${{ secrets.SPOTIFY_PASSWORD }}
              EPISODE_PATH: github/workspace
    
  • Be sure to set up the necessary secrets as per the GitHub instructions.

Environment Variables

To customize your automation, you can set various environment variables:

  • Draft Mode: If you want the episode to be published as a draft, set SAVE_AS_DRAFT to true.
  • Audio Conversion Options: Configure the audio settings using POSTPROCESSOR_ARGS to refine how the audio file is processed.
  • Explicit Mode: Mark your episode as explicit by setting IS_EXPLICIT to true.
  • Thumbnail Mode: Include the video thumbnail as episode art by setting LOAD_THUMBNAIL to true.
  • YouTube URL in Description: Automatically add the YouTube URL at the end of the podcast description by setting URL_IN_DESCRIPTION to true.

Setting Up for Development

If you’d like to run the script locally, ensure you have python3 and ffmpeg in your PATH. Then, follow these steps:

  • Clone the repository and run npm ci to install dependencies.
  • Edit the episode.json to include your YouTube video ID for testing.
  • Set up a .env file for your environment variables as needed.
  • Run the script with npm start.

Troubleshooting

If you encounter issues, consider the following troubleshooting tips:

  • Check if there is at least one manually published episode on your Anchor.fm account.
  • Review your environment variable settings, especially your login credentials.
  • Verify the structure of your episode.json file to ensure the YouTube ID is correctly formatted.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Final Thoughts

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox