• This repository has been archived on 16/May/2022
  • Stars
    star
    733
  • Rank 61,835 (Top 2 %)
  • Language
    Python
  • License
    Do What The F*ck ...
  • Created over 3 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fix Twitter video embeds in Discord (and Telegram!)

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://fxtwitter.com/[twitter video url] or [last half of twitter url] (everything past twitter.com/)

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

example

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

Child Projects:

TwitFix-Bot - A discord bot for automatically converting normal twitter links posted by users into twitfix links

TwitFix-Extension - A browser extention that lets you right click twitter videos to copy a twitfix link to your clipboard

Monthly Contributors

TwitFix is run for free, period, I have no plans to monetize it directly in any way ( no ads, no premium accounts with more features ) so I rely on donations to keep TwitFix running, and I have created the option to donate on a monthly basis using my KoFi

Here's a a list of the people who help to keep this project alive! ( current total monthly - $49!!! )

  1. [$3] First Contributor and Twitter Funnyman Chris Burwell ( @countchrisdo on Twitter )

  2. [$9] Previously highest Contributor, Suspciously wealthy furry, and a very loving friend Vectrobe ( @Vectrobe on Twitter )

  3. [$10] New highest monthly contributor, helloitscrash!

  4. [$6] A Mysterious and Anonymous contributor...

  5. [$10] One of the highest contributors, Ryan Vilbrandt!

  6. [$3] Starcat13, the one with the coolest sounding name

  7. [$5] THE LIGHT THROUGH WHICH GOD SPEAKS TO THIS EARTH: Statek

  8. [$3] Impulse, probably the source cheat

  9. [$3] a STRONG contendor for coolest name, "Lost in Art & Magic"

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

TwitFix 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

Going to https://fxtwitter.com/latest/ will present a page that shows the all the latest tweets that were added to the database, use with caution as results may be nsfw! Current page created by @DorukSaga

Using the /dir/<video-url> endpoint will return a redirect to the direct MP4 link, this can be useful for downloading a video

Using the /dl/<video-url> or appending a .mp4 will make the server download the video and return a static, locally hosted copy

Using the subdomain d.fxtwitter.com/<video-url> will redirect to a direct MP4 url hosted on Twitter

Using the /info/<video-url> endpoint will return a json that contains all video info that youtube-dl can grab about any given video

Using /other/<video-url> will attempt to run the twitter embed stuff on other websites videos - This is mostly experimental and doesn't really work for now

Using /api/latest/ will return a json with the latest tweet added to the database. Takes params ?tweets=INT&=pageINT to return multiple

Using /api/top/ will return a json with the most hit tweet in the database. Takes params ?tweets=INT&=pageINT to return multiple

Using /api/stats/ will return a json with some stats about TwitFix's activity (embeds, new cached links, API hits, downloads). Takes param ?=date"YYYY-MM-DD" to return a specific day, otherwise will return today's stats to far

Advanced embeds are provided via a /oembed.json? endpoint - This is manually pointing at my server in /templates/index.html and should be changed from https://fxtwitter.com/ to whatever your domain is

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

More Repositories

1

Keebie

Easy Second Keyboard support in Linux (With layers!)
Python
84
star
2

TwitFix-Extension

A browser extension that adds TwitFix url copy buttons to Twitter
JavaScript
25
star
3

SvoxBot

A C# Discord bot for Half-Life fans
C#
15
star
4

GrimstoneOS

Dark themed full minecraft GUI replacement
13
star
5

GiveMeOne

A Flask server that makes searching google images easier ( and DuckDuckGo! )
Python
12
star
6

fxdeviantart

Fix Deviantart Embeds in Discord
Python
12
star
7

DARKER

A Darker and more simplified theme for the GIMP
11
star
8

FxGitHub

An attempt to make a github embed that actually shows the code you link to
Python
11
star
9

TwitFix-Bot

A Discord bot that fixes twitter video embeds by switching them to TwitFix links
Python
10
star
10

PWMover

Creating Psuedo analogue controls for games that only accept digital inputs through pulse width modulation
C#
10
star
11

discho

Pipe bash to Discord!
JavaScript
8
star
12

scripts

A place to collect all my small scripts and dotfiles
Python
7
star
13

fixchip

various fixes for the pocket c.h.i.p.
Shell
5
star
14

PluralKit-Windows-Switcher

A set of scripts that allow your windows system to start up differently depending on whose fronting in pluralkit
PowerShell
5
star
15

TwitFix-Latest

Shows a stream of the latest posts used on TwitFix / FXTwitter
JavaScript
5
star
16

Twitch-Linux-Typer

Let Twitch chat type for you. Or maybe don't.
Python
4
star
17

robin16x

a set of royalty free 16x16 textures
HTML
3
star
18

Screencopy-Netscan

Scan a network for you phone based on MAC, then connect to it with scrcpy.
Shell
3
star
19

passing-thought

a quick and dirty sticky notes app written in C#
C#
3
star
20

PhotoOrg

A photo orginization tool for Photo Booths
C#
3
star
21

Dominae

Simple Bash based Discord.py bot
Python
2
star
22

blur

A script to quickly configure devilspie to set KDE blur and transparency on specific windows
Python
2
star
23

Dominae-2

Python
2
star
24

TagToolBat

just some automation for TagTool porting
Batchfile
2
star
25

imrobin

All my website files!
HTML
2
star
26

SurfacePro2-Rotate

Adds automatic rotation support to Linux for the Surface Pro 2
Python
2
star
27

AlphaCafe

Basic Twitter and Mastodon bot for creating Post X every X style bot accounts
Python
2
star
28

Blends

1
star
29

Definitely-Enough-Items

Like Standalone JEI (HEAVILY WIP)
JavaScript
1
star
30

VecTweet

Python
1
star
31

robinuniverse

1
star
32

.github

1
star
33

QOL-Minecraft-Recipes

Some quality of life time saving recipes for Minecraft
1
star
34

PurgeBot

A small one-shot discord bot for purging messages from a given channel
Python
1
star
35

adaptive-package-installer

Detect your Distro and use your appropriate package installer to install from a pre-defined list of packages
Shell
1
star
36

Wallpapers

All of my original artwork wallpapers
Shell
1
star
37

clipdl

Automatically detect content of link in clipboard, and try to download it with the appropriate tool ( LINUX )
Shell
1
star
38

Pathguider

Pathfinder helper for nerds
JavaScript
1
star
39

BabelDuck

A WIP DuckyScript intermediary language interpreter written in PowerShell
PowerShell
1
star
40

Dominae-3

An attempt at a full stack Discord bot
C#
1
star
41

DomiServ

A set of scripts made to help manage all aspects of Minecraft servers over discord
Python
1
star
42

MineOnline-Installer

A Simple MSI packaging of MineOnline to facilitate winget installs
1
star