commit
f19e3387ba
2 changed files with 6 additions and 1 deletions
|
@ -8,8 +8,9 @@
|
||||||
<meta name="twitter:card" content="player" />
|
<meta name="twitter:card" content="player" />
|
||||||
<meta name="twitter:title" content="{{ user }}" />
|
<meta name="twitter:title" content="{{ user }}" />
|
||||||
<meta name="twitter:image" content="{{ pic }}" />
|
<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 }}" />
|
||||||
|
|
|
@ -10,6 +10,7 @@ import os
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
pathregex = re.compile("\\w{1,15}\\/status\\/\\d{19}")
|
pathregex = re.compile("\\w{1,15}\\/status\\/\\d{19}")
|
||||||
discord_user_agents = ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0", "Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)"]
|
discord_user_agents = ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0", "Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)"]
|
||||||
|
telegram_user_agents = ["TelegramBot (like TwitterBot)"]
|
||||||
|
|
||||||
# Read config from config.json. If it does not exist, create new.
|
# Read config from config.json. If it does not exist, create new.
|
||||||
if not os.path.exists("config.json"):
|
if not os.path.exists("config.json"):
|
||||||
|
@ -72,6 +73,9 @@ def twitfix(sub_path):
|
||||||
if user_agent in discord_user_agents:
|
if user_agent in discord_user_agents:
|
||||||
res = embed_video(twitter_url)
|
res = embed_video(twitter_url)
|
||||||
return res
|
return res
|
||||||
|
if user_agent in telegram_user_agents:
|
||||||
|
res = embed_video(twitter_url)
|
||||||
|
return res
|
||||||
else:
|
else:
|
||||||
print("Redirect to " + twitter_url)
|
print("Redirect to " + twitter_url)
|
||||||
return redirect(twitter_url, 301)
|
return redirect(twitter_url, 301)
|
||||||
|
|
Loading…
Reference in a new issue