/radio_dixital

Rede Automatizada de Difusión Integral do Obradoiro Dixital

Primary LanguageTypeScriptGNU General Public License v3.0GPL-3.0

RADIOD

Docker Image Version Docker Pulls GitHub Actions Workflow Status Artifact Hub Repo

Live Notification example on Discord

RADIOD scrapes content from RSS feeds from Blogs, Podcasts, Youtube Videos and also from Youtube & Twitch APIs from the Galician Content Creators registered in the Asociación Cultural Obradoiro Dixital Galego. This content is then used to promote it through the organization social networks (Twitter, Mastodon & Discord) and also store it in a database to later consume it from internal dashboards.

Note

💡 The name "RADIOD" is a retroacronym in galician of "Rede Automatizada de Difusión en Internet do Obradoiro Dixital", which would be translated as "Obradoiro Digital Internet Promotion Automated Network".

🗂️ Table of Contents

🌈 Features

  • 🌐 Custom promotion messages for each social network and each content creator type (blogs, youtube, podcast, twitch).
  • 🤏 Loosely tied. Each task can be executed separatedly for easy debugging and disabling of unwanted functions.
  • 🦟 Use of MQTT Queues to communicate between each task as needed.
  • 🚀 Easy to setup with Docker, Kubernetes Helm Chart, or on bare metal.
  • 🆓 100% free and open-source
  • 🗞️ refreshBlogs, refreshPodcasts, refreshYoutube: These tasks store the Blogs, Podcasts and Youtube channels in the database, as well as its latests entries. Then send the newest entries to an MQTT Queue.
  • 📊 refreshYoutubeStats: Gathers stats like the channel views and subscribers from the Youtube API and stores them in the database for future analysis.
  • 📺 refreshTwitch, refreshTwitchClips, refreshTwitchGames: These tasks store information related to Twitch Channels, its "games" and clips, and help towards having all the required information in the refreshStreams.
  • 🚦 refreshStreams: Intended to be used every minute, it checks the active streams of the monitored channels and handles new and offline streams. It sends all the information required to make content rich notifications.
  • 🌎 publishTwitter, publishMastodon, publishDiscord: Subscribe the MQTT topic and publish status update on each social network for each new entry. Twitch Streams are also updated in Discord with a thumbnail of the stream while Live.

🐛 Known Bugs

  • So far, all fixed! 🥳

🛣️ Roadmap

  • Promote new Twitch Clips or Clips with more than a threshold number of views in the social networks.
  • Use KNative/OpenFunction to only launch publishers when there are messages, instead of having them pernanently listening the MQTT topics.

⬆️ Back to Top

🚀 Getting Started

🧩 Requirements

In order to run RADIOD you will need to have a running MySQL Database to store the information (You can check the schema needed here) and a MQTT Broker, i.e. Mosquitto.

You will also need some credentials for the different APIs used by RADIOD:

Twitch Application

In order to check Twitch API for channels, streams, clips, etc. you need to register an app in the Twitch Developer Console. From here you will extract the values needed for the ./src/config/twitch.config.ts

export default {
   client_id: "TWITCH_CLIENT_ID",
   client_secret: "TWITCH_CLIENT_SECRET",
};

Youtube (Google) API key

In order to get Youtube stats (Views, subscriptions) you need an API KEY with access to the Youtube API. Follow the official documentation to obtain it and then configure it on ./src/config/google.config.ts:

export default {
   appKey: "GOOGLE_APP_KEY",
};

Twitter API Credentials

Access the Twitter Developer Portal and create a new project with the account you want to publish on. You will need to enable auth and write permissions. Follow the documentation of the twitter-api-v2 library for more detailed instructions. Once done, configure the file ./src/config/twitter.config.ts following the example. You can also customize the message template there.

export default {
   youtube: {
      enable: true,
      messageTemplate:
         '🤖🎬 {channelName}{mentionUser} acaba de publicar o vídeo "{title}". Dálle unha ollada en\n{url} #GalegoTube #Youtubeiras #ObradoiroDixital',
      appKey: "TWITTER_APP_KEY",
      appSecret: "TWITTER_APP_SECRET",
      accessToken: "TWITTER_ACCESS_TOKEN",
      accessSecret: "TWITTER_ACCESS_SECRET",
   },
   podcast: [...],
   blog: [...],
   twitch: [...],
};

Mastodon API Credentials

Follow the documentation on the masto library for information on how to setup your API credentials. Then, configure ./src/config/mastodon.config.ts following the example. You can also customize the message template there.

Discord Webhook

Follow the official discord documentation on how to create a webhook. Then configure ./src/config/discord.config.ts following the example. You can also customize the message template there.

☸️ Running it on Kubernetes

The application is designed to be run in Kubernetes, and you can find a helm chart in here. By default the helm chart runs all the tasks in a predefined cron schedules and has the publishers (discord, twitter & mastodon) permanently listening for the mqtt topic. The only thing you need is to configure a secret with all the files in the config folder. The Helm chart will mount the secret as a folder with all the files in the required path for the application to run.

🐳 Running in Docker

The helm chart uses the docker images built as part of the Github Actions of this repo and published in Docker Hub. You can run each of the action passing the argument of the task specified in the deno.json and passing the folder with the configuration. i.e:

docker run -v ./src/config:/opt/radio_dixital/src/config --entrypoint deno pvillaverde/radio_dixital task publishDiscord

🧱 Running locally

You will need to have Deno installed in your machine, then you can run deno task to check all the available tasks and for example deno task refreshBlogs to get all the blogs information.

⬆️ Back to Top

🙋Support & Contributing

If you want to add any missing feature or report a bug, you can request ir or report it here. Also if you are want and know how to do it, go ahead! That's what make the open source community shines, by allowing us to grow and learn from each other creating amazing tools! Any contribution you make is greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

🏆 Credits & Acknowledgements 🙏

⚖️ License

GitHub license - Distributed under the GNU GPL-v3 License. See LICENSE on for more information.

🔗 Reference links and bibliography 📚

⬆️ Back to Top