obligatory fix commit for the stuff I didn't get right the first time
This commit is contained in:
parent
0fdcda924e
commit
80ed4bfa16
3 changed files with 5 additions and 17 deletions
17
readme.md
17
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**
|
||||
|
||||
|
|
2
requirements.txt
Normal file
2
requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
Flask
|
||||
youtube_dl
|
|
@ -8,7 +8,7 @@ import os
|
|||
ydl = youtube_dl.YoutubeDL({'outtmpl': '%(id)s.%(ext)s'})
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/twitfix/<path:subpath>')
|
||||
@app.route('/<path:subpath>')
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue