Use template for direct MP4 link
This commit is contained in:
parent
7e7530b90c
commit
9981a2deb0
16
templates/rawvideo.html
Normal file
16
templates/rawvideo.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{% extends 'base.html' %} {% block head %}
|
||||||
|
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
|
||||||
|
|
||||||
|
<meta name="twitter:player:stream" content="{{ vidurl }}" />
|
||||||
|
<meta name="twitter:player:stream:content_type" content="video/mp4" />
|
||||||
|
<meta name="twitter:player:width" content="{{ videoSize['width'] }}" />
|
||||||
|
<meta name="twitter:player:height" content="{{ videoSize['height'] }}" />
|
||||||
|
<meta property="og:url" content="{{ vidurl }}" />
|
||||||
|
<meta property="og:video" content="{{ vidurl }}" />
|
||||||
|
<meta property="og:video:secure_url" content="{{ vidurl }}" />
|
||||||
|
<meta property="og:video:type" content="video/mp4" />
|
||||||
|
<meta property="og:video:width" content="{{ videoSize['width'] }}" />
|
||||||
|
<meta property="og:video:height" content="{{ videoSize['height'] }}" />
|
||||||
|
<meta name="twitter:card" content="player" />
|
||||||
|
|
||||||
|
<meta http-equiv="refresh" content="0; url = {{ vidurl }}" /> {% endblock %} {% block body %} Redirecting you to the video in a moment. <a href="{{ vidurl }}">Or click here.</a> {% endblock %}
|
12
twitfix.py
12
twitfix.py
@ -67,9 +67,9 @@ def twitfix(sub_path):
|
|||||||
clean = twitter_url[:-4]
|
clean = twitter_url[:-4]
|
||||||
else:
|
else:
|
||||||
clean = twitter_url
|
clean = twitter_url
|
||||||
#vid = requests.get(direct_video_link(clean))
|
|
||||||
#return Response(vid.content,mimetype="video/mp4") keeping this here in case Discord changes their mind & blocks 307's
|
vnf = vnfFromCacheOrDL(clean)
|
||||||
return redirect(direct_video_link(clean),code=307) # Discord, why do you fail to play 301/302 redirected URLS with .mp4 at the end???
|
return getTemplate("rawvideo.html",vnf,"","",clean,"","","","")
|
||||||
else:
|
else:
|
||||||
return message("To use a direct MP4 link in discord, remove anything past '?' and put '.mp4' at the end")
|
return message("To use a direct MP4 link in discord, remove anything past '?' and put '.mp4' at the end")
|
||||||
else:
|
else:
|
||||||
@ -93,9 +93,9 @@ def twitfix(sub_path):
|
|||||||
clean = twitter_url[:-4]
|
clean = twitter_url[:-4]
|
||||||
else:
|
else:
|
||||||
clean = twitter_url
|
clean = twitter_url
|
||||||
# TODO: Cache this, but not for too long as disk space can fill up
|
|
||||||
vid = requests.get(direct_video_link(clean))
|
vnf = vnfFromCacheOrDL(clean)
|
||||||
return Response(vid.content,mimetype="video/mp4")
|
return getTemplate("rawvideo.html",vnf,"","",clean,"","","","")
|
||||||
|
|
||||||
elif request.url.endswith("/1") or request.url.endswith("/2") or request.url.endswith("/3") or request.url.endswith("/4") or request.url.endswith("%2F1") or request.url.endswith("%2F2") or request.url.endswith("%2F3") or request.url.endswith("%2F4"):
|
elif request.url.endswith("/1") or request.url.endswith("/2") or request.url.endswith("/3") or request.url.endswith("/4") or request.url.endswith("%2F1") or request.url.endswith("%2F2") or request.url.endswith("%2F3") or request.url.endswith("%2F4"):
|
||||||
twitter_url = "https://twitter.com/" + sub_path
|
twitter_url = "https://twitter.com/" + sub_path
|
||||||
|
Loading…
x
Reference in New Issue
Block a user