From 80ed4bfa16e6a95d2a5a1269ea7a04b49bc85805 Mon Sep 17 00:00:00 2001 From: Robin Universe Date: Sat, 3 Jul 2021 19:08:19 -0500 Subject: [PATCH] obligatory fix commit for the stuff I didn't get right the first time --- readme.md | 17 ++--------------- requirements.txt | 2 ++ twitfix.py | 3 +-- 3 files changed, 5 insertions(+), 17 deletions(-) create mode 100644 requirements.txt diff --git a/readme.md b/readme.md index d331838..d190fcc 100644 --- a/readme.md +++ b/readme.md @@ -2,30 +2,17 @@ very basic flask server that fixes twitter embeds in discord by using youtube-dl to grab the direct link to the MP4 file and embeds the link to it in a custom page - - This does work! but I'm new to flask, so it can probably be improved a great deal. - - ## How to use (discord side) -just put the url to the server, then /twitfix/, and directly after, the full URL to the tweet you want to embed - - +just put the url to the server,and directly after, the full URL to the tweet you want to embed ## How to run (server side) -this is in a virtual environment, so first you should enter the virtual environment using `source env/bin/activate` and then you can start the server with `python3 twitfix.py` - +this script uses the youtube-dl python module, along with flask, so install those with pip (you can use `pip install -r requirements.txt`) and start the server with `python twitfix.py` ( will need sudo if you leave it at port 80 ) By default I have the port set to 80, just cause that's what was convenient for me, but it can easily be changed, either using an environment variable, or changing the bottom line of the script itself - - -this script uses the youtube-dl python module, along with flask - - - This project is licensed under th **Do What The Fuck You Want Public License** diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c4aad5a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +Flask +youtube_dl diff --git a/twitfix.py b/twitfix.py index cf9347d..bfcb688 100644 --- a/twitfix.py +++ b/twitfix.py @@ -8,7 +8,7 @@ import os ydl = youtube_dl.YoutubeDL({'outtmpl': '%(id)s.%(ext)s'}) app = Flask(__name__) -@app.route('/twitfix/') +@app.route('/') def twitfix(subpath): if subpath.startswith('https://twitter.com'): with ydl: @@ -26,5 +26,4 @@ def info(subpath): return result if __name__ == "__main__": - app.run(debug=False) app.run(host='0.0.0.0', port=80)