Fix Twitter video embeds in Discord (and Telegram!)
Find a file
2022-05-18 18:21:00 +01:00
static Removed tracking/stats, anything non-embed related 2022-05-13 20:04:27 +01:00
templates Squashed commit of the following: 2022-05-15 01:47:20 +01:00
.gitignore Serverless config 2022-05-15 01:14:41 +01:00
LICENSE.txt Too Init To Quit 2021-07-03 18:52:30 -05:00
package-lock.json Updated serverless.yml to dockerize pip packages 2022-05-15 17:06:42 +01:00
package.json Updated serverless.yml to dockerize pip packages 2022-05-15 17:06:42 +01:00
readme.md Updated readme 2022-05-14 00:24:58 +01:00
requirements.txt DynamoDB support & Serverless config update 2022-05-16 19:28:31 +01:00
serverless.yml DynamoDB support & Serverless config update 2022-05-16 19:28:31 +01:00
twitfix.ini Initial changes 2022-05-13 17:00:16 +00:00
twitfix.py Fixed DynamoDB integration 2022-05-18 18:21:00 +01:00
twitfix.service Initial changes 2022-05-13 17:00:16 +00:00
wsgi.py Fix tweet text content appearing in telegram 2022-05-03 11:13:34 -04:00

vxTwitter

(A fork of TwitFix) Basic flask server that serves fixed twitter video embeds to desktop discord by using either the Twitter API or Youtube-DL to grab tweet video information. This also automatically embeds the first link in the text of non video tweets (API Only)

How to use (discord side)

just put the url to the server, and directly after, the full URL to the tweet you want to embed

I now have a copy of this running on a Linode server, you can use it via the following url

https://vxtwitter.com/[twitter video url] or [last half of twitter url] (everything past twitter.com/)

You can also simply type out 'vx' directly before 'twitter.com' in any valid twitter video url, and that will convert it into a working vxTwitter url, for example:

Note: If you enjoy this service, please considering donating via Ko-Fi to help cover server costs

How to run (server side)

this script uses the youtube-dl python module, along with flask, twitter and pymongo, so install those with pip (you can use pip install -r requirements.txt) and start the server with python twitfix.py

I have included some files to give you a head start on setting this server up with uWSGI, though if you decide to use uWSGI I suggest you set up mongoDB link caching

Config

vxTwitter generates a config.json in its root directory the first time you run it, the options are:

API - This will be where you put the credentials for your twitter API if you use this method

database - This is where you put the URL to your mongoDB database if you are using one

link_cache - (Options: db, json)

  • db: Caches all links to a mongoDB database. This should be used it you are using uWSGI and are not just running the script on its own as one worker
  • json: This saves cached links to a local links.json file

method - ( Options: youtube-dl, api, hybrid )

  • youtube-dl: the original method for grabbing twitter video links, this uses a guest token provided via youtube-dl and should work well for individual instances, but may not scale up to a very large amount of usage

  • api: this directly uses the twitter API to grab tweet info, limited to 900 calls per 15m

  • hybrid: This will start off by using the twitter API to grab tweet info, but if the rate limit is reached or the api fails for any other reason it will switch over to youtube-dl to avoid downtime

color - Accepts a hex formatted color code, can change the embed color

appname - Can change the app name easily wherever it's shown

repo - used to change the repo url that some links redirect to

url - used to tell the user where to look for the oembed endpoint, make sure to set this to your public facing url

This project is licensed under the Do What The Fuck You Want Public License

Other stuff

We check for t.co links in non video tweets, and if one is found, we direct the discord useragent to embed that link directly, this means that twitter links containing youtube / vimeo links will automatically embed those as if you had just directly linked to that content