🐦 Loritta's Social media relayer via Discord Webhooks micro-service

Related tags

App SocialRelayer
Overview

🐦 SocialRelayer 🐦

SocialRelayer is a social media relayer to Discord via webhooks, pulling Loritta's guild configurations to automatically register and synchronize new posts from other platforms to Discord.

SocialRelayer is not really a "micro-service", from the words of Napster...

if your "microservices" are accessing the same tables, you dont have microservices, you have a distributed monolith

This is intentional to Keep It Simple, Stupid! 😛

Currently we don't need to receive YouTube/Twitch/Twitter/etc notifications from other projects that aren't Loritta, however if some day we need to do this, refactoring SocialRelayer to support this shouldn't be that hard.

🔄 Synchronization

While this repository is targeted only to Loritta, the repository still contains some nifty tricks to synchronize social media data to Discord, which they may be useful to other developers, here's a high level overview of the tips and tricks we implemented.

🐦 Twitter

Twitter tweet synchronization uses a multitude of different methods to track all tweets from all tracked accounts, falling back when a method is in its limits.

To track everyone...

  • The top 10000 accounts are tracked via Twitter API v1 Stream, Twitter API v1 Stream is the best because you can register 5000 users per stream (you can have two streams per IP) and there aren't any tweet limits!
  • From the remaining accounts, the top ~200 accounts are tracked via Twitter API v2 Stream, Twitter API v2 Stream is worse than the Twitter API v1 Stream and you can't even get near the limit Twitter API v1 Stream provides, Twitter API v2 Stream uses Twitter Search Rules (user:LorittaBot OR user:MrPowerGamerBR...) so your tracked account limit is based on the length of the usernames you want to track. You can register 25 rules and all rules needs to have less than 512 characters. Twitter API v2 Stream also consumes your monthly quota of tweets,
  • The remaining accounts are then tracked via polling Twitter's Timeline via the Publish embed. There doesn't seem to have any limits in the Publish embed and because it is hosted in a cdn domain the chances of you getting IP banned seems to be very low. However polling is a gigantic cumbersome task that uses a lot of resources, so Loritta periodically checks the timelines depending on the user's activity.
    • The endpoint is https://cdn.syndication.twimg.com/timeline/profile?callback=__twttr.callbacks.tl_i0_profile_${screenName}_old&dnt=true&domain=${randomDomainHere}&lang=en&screen_name=${screenName}&suppress_response_codes=true&t=${System.currentTimeMillis() / 1_000}&tz=GMT-0100&with_replies=false. This endpoint uses JSONP. If successful, the response will contain the HTML of the Twitter Timeline Embed, if not, the response will contain an error.
    • User tweeted in the last 3 days? Check every 30 seconds!
    • User tweeted in the last 7 days? Check every 120 seconds!
    • User tweeted in the last 14 days? Check every 5 minutes!
    • User made their account private (or there was a polling error)? Check every 24 hours!
    • Anything else? Check every 15 minutes!
    • The requests also have a bit of randomness in them to avoid querying everything all at once, and to make the requests seem less sus.

There are also some other polling methods that could be implemented if Twitter starts limiting its API...

  • Add all tracked users to a list, however you may get list shadow-banned for a few days. Twitter allows you to query all the tweets in a single list, making it perfect as a polling alternative and it uses way less requests than polling everyone manually!

📽️ YouTube

TODO

🛀 Twitch

TODO

You might also like...
Taiwan Social Distancing App - Android

social-distancing-android 臺灣社交距離 App 由衛生福利部疾病管制署與台灣人工智慧實驗室共同研發,提供臺灣地區用戶接收 COVID-19 接觸通知,並提醒收到接觸通知的用戶連繫當地衛生局,以減少傳染風險。 ● 保障個人隱私 利用手機藍牙功能來估計社交互動,資料以匿名方式儲

✨ Social network app made with Android Compose, full Kotlin, Firebase Authentication, Storage and Firestore 🚀
✨ Social network app made with Android Compose, full Kotlin, Firebase Authentication, Storage and Firestore 🚀

Your friends, for real. Share daily random moments with your friends and discover who they really are. ✨ Instant Instant is a social media actually un

Modern Social Profile Layout For Android
Modern Social Profile Layout For Android

Social Profile Layout Modern Simple Social Profile Layout for your Android App Project Installation Just run this project on your Android Studio Proje

Covidapp - The COVID-19 crisis and social distancing had a significant impact on our lives
Covidapp - The COVID-19 crisis and social distancing had a significant impact on our lives

Covid App The COVID-19 crisis and social distancing had a significant impact on

Simple app to Transfer Media and Text from computer to mobile.

TransferByte Simple app to Transfer Media and Text from computer to mobile.Written in kotlin. Recycler view used for listing the media posted and down

Picker-kt - Media picker library powered by Jetpack Compose
Picker-kt - Media picker library powered by Jetpack Compose

ANDROID LIBRARY PickerKT A media picker library for Android apps powered by Jetp

Simple media hosting system written in kotlin.
Simple media hosting system written in kotlin.

media-server This project is a simple media server implementation that allows you to upload and share files. This project was made in Kotlin and HTML,

An Android app to stream and download your media stored in Google Drive in an Awesome way !!
An Android app to stream and download your media stored in Google Drive in an Awesome way !!

⚡ Thunder : An Android app to stream and download your media stored in Google Drive in an Awesome way !! (Just Movies for now) 🔘 Getting Started : Le

An open-source reimplementation of the Discord Android app

OpenCord An open source reimplementation of the Discord Android app. Why does this exist? Current discord app sucks as it looks ugly and doesn't suppo

Comments
  • Ask for Twitch authorization

    Ask for Twitch authorization

    https://dev.twitch.tv/docs/eventsub#subscription-limits

    If the user authorizes themselves, the cost of a EventSub subscription is zero instead of one. This would avoid having multiple Twitch applications just to track channels.

    However this still needs to be checked out to figure out how it works!

    opened by MrPowerGamerBR 1
Owner
Loritta
Yet another bot for Discord
Loritta
A minimalist clone of the popular Social Media Platform "Instagram"

InstaLocal A minimalist clone of the popular Social Media Platform "Instagram" powered by Firebase and written in Kotlin. The app allows users to sign

Raktim Bhuyan 1 Nov 7, 2021
H4SGTAG MANAGER - CRUD that saves hashtags for social media

H4SGTAG_MANAGER CRUD that saves hashtags for social media made using android stu

Aldo Malacara 0 Jan 13, 2022
A fully functional social media app built with Kotlin (Android Studio) with multiple features

A social media app built with Kotlin (Android Studio) with multiple features ?? If you like this repo, give it a star ✨ and share ????‍?? it to your f

ThanhPhong 9 Dec 13, 2022
Social media app but with new features like translate messages and posts , support video & images as posts , chat and notifications , etc...

social-media-app Social media app but with new features like translate messages and posts , support video & images as posts , chat and notifications ,

Kareem Aboelatta 15 Dec 13, 2022
Is a new version of code for my (Social media app) with Clean Architecture

Is a new version of code for my Social media app with Clean Architecture. I used most of Clean code tips with android, SOLID principles and design-patterns..

Kareem Aboelatta 20 Dec 13, 2022
Media Provider Manager - An Xposed module intended to prevent media storage abuse

Media Provider Manager - An Xposed module intended to prevent media storage abuse

null 104 Dec 26, 2022
HyperUPnP is Android Application that lets you to Stream Media from PC, NAS or any other device running UPnP/DLNA compliant media server to your Android Device.

Hyper UPnP Android UPnP/DLNA client Stream Media from PC, NAS or any other device running UPnP/DLNA compliant media server to your Android Device. Int

Var Bhat 8 Jul 17, 2022
A messaging social platform based on Discord for Desktop and Android.

AP-FinalProject A secure messaging social platform based on Discord for Desktop and Android. This is my final project for Advanced-Programming (AP) in

AmirHosseinAghajari 10 Oct 1, 2022
A cryptocurrency data aggregator that tracks price, volume, social stats.

CryptoMania A cryptocurrency data aggregator that tracks price, volume, social stats. Challenge description Design & implement an Android application

Gabriel TEKOMBO 23 Aug 6, 2022