Skip to content

Latest commit

 

History

History
81 lines (57 loc) · 3.75 KB

README.md

File metadata and controls

81 lines (57 loc) · 3.75 KB

Download Yle Areena/YouTube media file and upload it to cloud storage

Introduction

This repo contains two GitHub Actions Workflow files.

One of those (areena_download_and_store.yml) is used to download Yle Areena media file and upload it to cloud storage.

Another one (youtube_download_and_store.yml) does the same thing for a YouTube video.

Yle Areena functionality

If that Yle Areena specific GitHub action is run, it

  1. takes as a parameter an Areena program URL (e.g. https://areena.yle.fi/1-50250719),
  2. clones yle-dl repo and checkouts branch/tag/commit specified in environment variable CHECKOUT_REF (default value = master),
  3. installs yle-dl locally using pip,
  4. downloads and installs required dependencies (ffmpeg),
  5. downloads the Areena program that was given as a parameter,
  6. installs mkvtoolnix and uses extract_subtitles.sh script to extract subtitles as individual srt files,
  7. installs rclone and writes its configuration file (.rclone.conf) using value from environment variable RCLONE_CONF (which refers to a repo secret called RCLONE_CONF),
  8. uploads the downloaded media file (and its possible srt files) to cloud storage using rclone

YouTube functionality

If that YouTube specific GitHub action is run, it

  1. takes as a parameter:
  1. installs yt-dlp using pip,
  2. downloads and installs required dependencies (ffmpeg),
  3. downloads the YouTube video (and its possible subtitles) that was given as a parameter,
  4. installs rclone and writes its configuration file (.rclone.conf) using value from environment variable RCLONE_CONF (which refers to a repo secret called RCLONE_CONF),
  5. uploads the downloaded media file (and its possible subtitle files) to cloud storage using rclone

Configuration

Configuration is done via environment variables and repo secrets

  • CHECKOUT_REF

    • Parameter for yle-dl git checkout (branch/tag/commit reference). This is included in case the current master branch is buggy, and you need to checkout e.g. the last working tag.
    • Default value = master
  • RCLONE_CONF

    • Refers to a repo secret called RCLONE_CONF
    • Configure rclone locally to use your preferred cloud storage, then copy the content of .rclone.conf to a repo secret called RCLONE_CONF
  • RCLONE_REMOTE_REF

    • Remote target (cloud storage) reference in your .rclone.conf file
    • Make sure to name your rclone remote storage reference as "remote" during rclone configuration, or change the default value.
    • Default value = remote
  • RCLONE_REMOTE_CLOUD_PATH

    • Path in the cloud storage where the video file will be uploaded
    • Default value = media_dls
  • RCLONE_OPTS:

    • Additional parameters for rclone
    • Default value = -P --create-empty-src-dirs (i.e. progress indicator, create empty dirs on remote storage)

yle-dl configuration

When downloading media files, yle-dl uses parameters specified in the config file .yledl.conf. Feel free to modify it to your liking.

rclone configuration

See https://rclone.org/commands/rclone_config/

Your .rclone.conf (or rclone.conf in Windows) should look like this:

[remote]
type = <<.e.g onedrive>>
token = {<<accesstoken>>}
drive_id = <<12345678>>
drive_type = personal

That config is for OneDrive, but if you're using another cloud storage, your config probably looks different.