Fixed infinite redirect(?)

This commit is contained in:
Dylan 2022-05-15 01:42:22 +01:00
parent 85c682ab11
commit fba1256efd
5 changed files with 69 additions and 92 deletions

View file

@ -14,22 +14,17 @@
{{ pfp }} - URL of the posters PFP {{ pfp }} - URL of the posters PFP
--> -->
{% block head %} {% block head %}
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<meta content="{{ color }}" name="theme-color" /> <meta content="{{ color }}" name="theme-color" />
<meta property="og:site_name" content="{{ appname }}"/> <meta property="og:site_name" content="{{ appname }}" />
<meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="{{ user }} (@{{ screenName }})" /> <meta name="twitter:title" content="{{ user }} (@{{ screenName }})" />
<meta name="twitter:image" content="{{ pic }}" /> <meta name="twitter:image" content="{{ pic }}" />
<meta name="twitter:image" content="{{ pic }}" /> <meta name="twitter:image" content="{{ pic }}" />
<meta name="twitter:creator" content="@{{ user }}" /> <meta name="twitter:creator" content="@{{ user }}" />
<meta property="og:description" content="{{ desc }}" /> <meta property="og:description" content="{{ desc }}" />
<!--<link rel="alternate" href="{{ url }}/oembed.json?desc={{ urlUser }}&user=Twitter&link={{ urlLink }}&ttype=photo" type="application/json+oembed" title="{{ user }}">-->
<meta http-equiv = "refresh" content = "0; url = {{ vidlink }}" />
{% endblock %}
{% block body %} <!--<link rel="alternate" href="{{ url }}/oembed.json?desc={{ urlUser }}&user=Twitter&link={{ urlLink }}&ttype=photo" type="application/json+oembed" title="{{ user }}">-->
Redirecting you to the tweet in a moment. <a href="{{ vidlink }}">Or click here.</a> <meta http-equiv="refresh" content="0; url = {{ tweetLink }}" /> {% endblock %} {% block body %} Redirecting you to the tweet in a moment. <a href="{{ tweetLink }}">Or click here.</a> {% endblock %}
{% endblock %}

View file

@ -1,37 +1,30 @@
{% extends 'base.html' %} {% extends 'base.html' %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
<meta content="{{ color }}" name="theme-color" />
<meta property="og:site_name" content="{{ appname }}">
{% block head %} <meta name="twitter:card" content="player" />
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' /> <meta name="twitter:title" content="{{ user }}" />
<meta content="{{ color }}" name="theme-color" /> <meta name="twitter:image" content="{{ pic }}" />
<meta property="og:site_name" content="{{ appname }}"> <!-- The line below breaks Telegram embeds if present but doesn't affect Discord embeds if removed
<meta name="twitter:card" content="player" />
<meta name="twitter:title" content="{{ user }}" />
<meta name="twitter:image" content="{{ pic }}" />
<!-- The line below breaks Telegram embeds if present but doesn't affect Discord embeds if removed
<meta name="twitter:player" content="{{ vidurl }}" /> <meta name="twitter:player" content="{{ vidurl }}" />
<meta name="twitter:description" content="{{ desc }}" />!--> <meta name="twitter:description" content="{{ desc }}" />!-->
<meta name="twitter:player:width" content="720" /> <meta name="twitter:player:width" content="720" />
<meta name="twitter:player:height" content="480" /> <meta name="twitter:player:height" content="480" />
<meta name="twitter:player:stream" content="{{ vidurl }}" /> <meta name="twitter:player:stream" content="{{ vidurl }}" />
<meta name="twitter:player:stream:content_type" content="video/mp4" /> <meta name="twitter:player:stream:content_type" content="video/mp4" />
<meta property="og:url" content="{{ vidlink }}" />
<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="720" />
<meta property="og:video:height" content="480" />
<meta property="og:title" content="{{ user }}" />
<!--<meta property="og:description" content="{{ desc }}" />!-->
<meta property="og:image" content="{{ pic }}" />
<!--!--> <meta property="og:url" content="{{ vidlink }}" />
<link rel="alternate" href="{{ url }}/oembed.json?desc={{ urlUser }}&user={{ urlDesc }}&link={{ urlLink }}" type="application/json+oembed" title="{{ user }}"> <meta property="og:video" content="{{ vidurl }}" />
<meta http-equiv = "refresh" content = "0; url = {{ vidlink }}" /> <meta property="og:video:secure_url" content="{{ vidurl }}" />
{% endblock %} <meta property="og:video:type" content="video/mp4" />
<meta property="og:video:width" content="720" />
<meta property="og:video:height" content="480" />
<meta property="og:title" content="{{ user }}" />
<!--<meta property="og:description" content="{{ desc }}" />!-->
<meta property="og:image" content="{{ pic }}" />
{% block body %} <!--!-->
Redirecting you to the tweet in a moment. <a href="{{ vidlink }}">Or click here.</a> <link rel="alternate" href="{{ url }}/oembed.json?desc={{ urlUser }}&user={{ urlDesc }}&link={{ urlLink }}" type="application/json+oembed" title="{{ user }}">
{% endblock %} <meta http-equiv="refresh" content="0; url = {{ tweetLink }}" /> {% endblock %} {% block body %} Redirecting you to the tweet in a moment. <a href="{{ tweetLink }}">Or click here.</a> {% endblock %}

View file

@ -18,22 +18,17 @@
{{ time }} - Time Created {{ time }} - Time Created
--> -->
{% block head %} {% block head %}
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<meta content="{{ color }}" name="theme-color" /> <meta content="{{ color }}" name="theme-color" />
<meta property="og:site_name" content="{{ appname }}"/> <meta property="og:site_name" content="{{ appname }}" />
<meta property="og:image" content="{{ pfp }}" /> <meta property="og:image" content="{{ pfp }}" />
<meta name="twitter:card" content="tweet" /> <meta name="twitter:card" content="tweet" />
<meta name="twitter:title" content="{{ user }} (@{{ screenName }})" /> <meta name="twitter:title" content="{{ user }} (@{{ screenName }})" />
<meta name="twitter:image" content="{{ pic }}" /> <meta name="twitter:image" content="{{ pic }}" />
<meta name="twitter:creator" content="@{{ user }}" /> <meta name="twitter:creator" content="@{{ user }}" />
<meta property="og:description" content="{{ desc }}" /> <meta property="og:description" content="{{ desc }}" />
<link rel="alternate" href="{{ url }}/oembed.json?desc={{ urlUser }}&user=Twitter&link={{ urlLink }}&ttype=link" type="application/json+oembed" title="{{ user }}">
<meta http-equiv = "refresh" content = "0; url = {{ vidlink }}" />
{% endblock %}
{% block body %} <link rel="alternate" href="{{ url }}/oembed.json?desc={{ urlUser }}&user=Twitter&link={{ urlLink }}&ttype=link" type="application/json+oembed" title="{{ user }}">
Redirecting you to the tweet in a moment. <a href="{{ vidlink }}">Or click here.</a> <meta http-equiv="refresh" content="0; url = {{ tweetLink }}" /> {% endblock %} {% block body %} Redirecting you to the tweet in a moment. <a href="{{ tweetLink }}">Or click here.</a> {% endblock %}
{% endblock %}

View file

@ -1,31 +1,24 @@
{% extends 'base.html' %} {% extends 'base.html' %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
<meta content="{{ color }}" name="theme-color" />
<meta property="og:site_name" content="{{ appname }}">
{% block head %} <meta name="twitter:card" content="player" />
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' /> <meta name="twitter:title" content="{{ user }} (@{{ screenName }})" />
<meta content="{{ color }}" name="theme-color" /> <meta name="twitter:image" content="{{ pic }}" />
<meta property="og:site_name" content="{{ appname }}"> <meta name="twitter:player:width" content="720" />
<meta name="twitter:player:height" content="480" />
<meta name="twitter:player:stream" content="{{ vidurl }}" />
<meta name="twitter:player:stream:content_type" content="video/mp4" />
<meta name="twitter:card" content="player" /> <meta property="og:url" content="{{ vidlink }}" />
<meta name="twitter:title" content="{{ user }} (@{{ screenName }})" /> <meta property="og:video" content="{{ vidurl }}" />
<meta name="twitter:image" content="{{ pic }}" /> <meta property="og:video:secure_url" content="{{ vidurl }}" />
<meta name="twitter:player:width" content="720" /> <meta property="og:video:type" content="video/mp4" />
<meta name="twitter:player:height" content="480" /> <meta property="og:video:width" content="720" />
<meta name="twitter:player:stream" content="{{ vidurl }}" /> <meta property="og:video:height" content="480" />
<meta name="twitter:player:stream:content_type" content="video/mp4" /> <meta name="twitter:title" content="{{ user }} (@{{ screenName }})" />
<meta property="og:image" content="{{ pic }}" />
<meta property="og:url" content="{{ vidlink }}" />
<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="720" />
<meta property="og:video:height" content="480" />
<meta name="twitter:title" content="{{ user }} (@{{ screenName }})" />
<meta property="og:image" content="{{ pic }}" />
<link rel="alternate" href="{{ url }}/oembed.json?desc={{ urlUser }}&user={{ urlDesc }}&link={{ urlLink }}&ttype=video" type="application/json+oembed" title="{{ user }}"> <link rel="alternate" href="{{ url }}/oembed.json?desc={{ urlUser }}&user={{ urlDesc }}&link={{ urlLink }}&ttype=video" type="application/json+oembed" title="{{ user }}">
<meta http-equiv = "refresh" content = "0; url = {{ vidlink }}" /> <meta http-equiv="refresh" content="0; url = {{ tweetLink }}" /> {% endblock %} {% block body %} Redirecting you to the tweet in a moment. <a href="{{ tweetLink }}">Or click here.</a> {% endblock %}
{% endblock %}
{% block body %}
Redirecting you to the tweet in a moment. <a href="{{ vidlink }}">Or click here.</a>
{% endblock %}

View file

@ -465,7 +465,8 @@ def embed(video_link, vnf, image):
url = config['config']['url'], url = config['config']['url'],
urlDesc = urlDesc, urlDesc = urlDesc,
urlUser = urlUser, urlUser = urlUser,
urlLink = urlLink ) urlLink = urlLink,
tweetLink = vnf['tweet'] )
def tweetType(tweet): # Are we dealing with a Video, Image, or Text tweet? def tweetType(tweet): # Are we dealing with a Video, Image, or Text tweet?
if 'extended_entities' in tweet: if 'extended_entities' in tweet: