big fix for mp4 (I think)
Signed-off-by: Chloe Carver-Brown <admin@twxtter.com>
This commit is contained in:
parent
4ef0a709cc
commit
0fe2027bc1
|
@ -70,7 +70,7 @@ function forNow() {
|
|||
function fetchNApply(page) {
|
||||
try {
|
||||
loading = true;
|
||||
fetch(`https://fxtwitter.com/api/latest/?tweets=10&page=${page}`)
|
||||
fetch(`https://twxtter.com/api/latest/?tweets=10&page=${page}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
data.forEach(e => createTweet(e));
|
||||
|
@ -265,7 +265,7 @@ function createTweet(json) {
|
|||
const rts = createEl("div", "cont", { inner: `${json["rts"]} Retweets` });
|
||||
const lks = createEl("div", "cont", { inner: `${json["likes"]} Likes` });
|
||||
|
||||
const share = createEl("img", "share", { src: "https://fxtwitter.com/copy.svg" });
|
||||
const share = createEl("img", "share", { src: "https://twxtter.com/copy.svg" });
|
||||
|
||||
meta.appendChild(rts);
|
||||
meta.appendChild(lks);
|
||||
|
@ -277,7 +277,7 @@ function createTweet(json) {
|
|||
imgPrev(img);
|
||||
});
|
||||
share.addEventListener("click", () =>
|
||||
navigator.clipboard.writeText(json["tweet"].replace("https://t", "https://fxt"))
|
||||
navigator.clipboard.writeText(json["tweet"].replace("https://twi", "https://twx"))
|
||||
);
|
||||
|
||||
tweetCount++;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
@font-face {
|
||||
font-family: NotoColorEmojiLimited;
|
||||
unicode-range: U+1F1E6-1F1FF;
|
||||
src: url("https://fxtwitter.com/font.ttf");
|
||||
src: url("https://twxtter.com/font.ttf");
|
||||
}
|
||||
|
||||
:root {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{% extends 'base.html' %}
|
||||
<!--
|
||||
{{ color }} - Custom Color Code set in the TwitFix Config
|
||||
{{ appname }} - Custom Appname set in the TwitFix Config
|
||||
{{ color }} - Custom Color Code set in the Twxtter Config
|
||||
{{ appname }} - Custom Appname set in the Twxtter Config
|
||||
{{ user }} - Username of the Source Tweet
|
||||
{{ pic }} - Thumbnail Image for a given video
|
||||
{{ vidlink }} - Direct link back to the source tweet
|
||||
{{ vidurl }} - Direct MP4 link to the video contained in the tweet
|
||||
{{ desc }} - Tweet Text
|
||||
{{ url }} - Base URL of the site hosting TwitFix
|
||||
{{ url }} - Base URL of the site hosting Twxtter
|
||||
{{ urlDesc }} - HTTP Encoded Tweet Text
|
||||
{{ urlUser }} - HTTP Encoded Username
|
||||
{{ urlLink }} - HTTP Encoded source link
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block head %}
|
||||
<title> TwitFix {{ page }}</title>
|
||||
<title> Twxtter {{ page }}</title>
|
||||
<script>
|
||||
window.onload = () => {
|
||||
document.querySelector("#block>div").addEventListener('click', () => document.getElementById("block").style.display = "none");
|
||||
|
@ -114,7 +114,7 @@
|
|||
Potentially NSFW Content: Click here if you are over 18
|
||||
</div>
|
||||
</div>
|
||||
<div><a href="{{ repo }}">TwitFix</a> {{ page }} Video</div>
|
||||
<div><a href="{{ repo }}">Twxtter</a> {{ page }} Video</div>
|
||||
<div>WARNING: Video content is not screened so it may contain NSFW Content</div>
|
||||
<video width="720" height="480" controls>
|
||||
<source src="{{ vidlink }}" type="video/mp4">
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Twitfix Latest</title>
|
||||
<title>Twxtter Latest</title>
|
||||
<link rel="stylesheet" href={{ url_for('static', filename='style.css' ) }}>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Paytone+One&display=swap" rel="stylesheet">
|
||||
</head>
|
||||
|
@ -21,37 +21,36 @@
|
|||
<div class="base">
|
||||
<div id="block">
|
||||
<p class="warn">Warning!!</p>
|
||||
<p>Twitfix only filters the content specified as NSFW.</p>
|
||||
<p>Twxtter only filters the content specified as NSFW.</p>
|
||||
<p>Following content might be NSFW.</p>
|
||||
<p>Prepare yourself mentally and pick one of the options</p>
|
||||
<p>Do you want to see the latest twitfix requests?</p>
|
||||
<p>Do you want to see the latest Twxtter requests?</p>
|
||||
<br>
|
||||
<div class="boptions">
|
||||
<div onclick="cookieTime()">Yes, don't ask again!</div>
|
||||
<div onclick="forNow()">Yes, for now.</div>
|
||||
<div onclick="window.location.replace('https://github.com/robinuniverse/TwitFix')">No, please take me
|
||||
<div onclick="window.location.replace('https://github.com/Twxtter/Twxtter-main')">No, please take me
|
||||
out of here</div>
|
||||
</div>
|
||||
</div>
|
||||
<a href="https://github.com/robinuniverse/TwitFix" class="top" rel="noreferrer" target="_blank">TwitFix
|
||||
<a href="https://github.com/Twxtter/Twxtter-main" class="top" rel="noreferrer" target="_blank">Twxtter
|
||||
Latest</a>
|
||||
<div class="bottom">
|
||||
<div class="info side">
|
||||
<div>TwitFix</div>
|
||||
<div>Twxtter</div>
|
||||
<div class="Iinner">
|
||||
Basic flask server that serves fixed twitter video embeds to desktop discord by using either the
|
||||
Twitter API or Youtube-DL to grab tweet video information. This also automatically embeds the first
|
||||
link in the text of non video tweets (API Only).
|
||||
</div>
|
||||
<br>
|
||||
<div>TwitFix Latest</div>
|
||||
<div>Twxtter Latest</div>
|
||||
<div class="Iinner">
|
||||
Shows the most recent TwitFix API requests in a list like manner.
|
||||
Shows the most recent Twxtter API requests in a list like manner.
|
||||
</div>
|
||||
<br>
|
||||
<div class="Iinner">
|
||||
TwitFix by <a href="https://hirob.in/" target="_blank" rel="noopener noreferrer">Robin
|
||||
✨Universe</a><br><br>
|
||||
Twxtter by <a href="https://github.com/lyricalpaws" target="_blank" rel="noopener noreferrer">Chloe</a><br><br>
|
||||
Site Design by <a href="https://twitter.com/doruksega" target="_blank"
|
||||
rel="noopener noreferrer">Doruk</a>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>TwitFix Stats</title>
|
||||
<title>Twxtter Stats</title>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{% extends 'base.html' %}
|
||||
<!--
|
||||
{{ color }} - Custom Color Code set in the TwitFix Config
|
||||
{{ appname }} - Custom Appname set in the TwitFix Config
|
||||
{{ color }} - Custom Color Code set in the Twxtter Config
|
||||
{{ appname }} - Custom Appname set in the Twxtter Config
|
||||
{{ user }} - Username of the Source Tweet
|
||||
{{ pic }} - Thumbnail Image for a given video
|
||||
{{ vidlink }} - Direct link back to the source tweet
|
||||
{{ vidurl }} - Direct MP4 link to the video contained in the tweet
|
||||
{{ desc }} - Tweet Text
|
||||
{{ url }} - Base URL of the site hosting TwitFix
|
||||
{{ url }} - Base URL of the site hosting Twxtter
|
||||
{{ urlDesc }} - HTTP Encoded Tweet Text
|
||||
{{ urlUser }} - HTTP Encoded Username
|
||||
{{ urlLink }} - HTTP Encoded source link
|
||||
|
|
10
twitfix.py
10
twitfix.py
|
@ -286,10 +286,10 @@ def twitfix(sub_path):
|
|||
print(request.url)
|
||||
|
||||
if request.url.startswith(
|
||||
"https://d.fx"
|
||||
"https://d.twx"
|
||||
): # Matches d.fx? Try to give the user a direct link
|
||||
if user_agent in generate_embed_user_agents:
|
||||
print(" ➤ [ D ] d.fx link shown to discord user-agent!")
|
||||
print(" ➤ [ D ] d.twx link shown to discord user-agent!")
|
||||
if request.url.endswith(".mp4") and "?" not in request.url:
|
||||
return dl(sub_path)
|
||||
else:
|
||||
|
@ -297,7 +297,7 @@ def twitfix(sub_path):
|
|||
"To use a direct MP4 link in discord, remove anything past '?' and put '.mp4' at the end"
|
||||
)
|
||||
else:
|
||||
print(" ➤ [ R ] Redirect to MP4 using d.fxtwitter.com")
|
||||
print(" ➤ [ R ] Redirect to MP4 using d.twxtter.com")
|
||||
return dir(sub_path)
|
||||
|
||||
elif request.url.endswith(".mp4") or request.url.endswith("%2Emp4"):
|
||||
|
@ -433,13 +433,13 @@ def dl(sub_path):
|
|||
print(" ➤ [[ FILE DOES NOT EXIST, DOWNLOADING... ]]")
|
||||
addToStat("downloads")
|
||||
mp4file = urllib.request.urlopen(mp4link)
|
||||
with open(("/home/robin/twitfix/static/" + filename), "wb") as output:
|
||||
with open(("/srv/Twxtter-main/static/" + filename), "wb") as output:
|
||||
output.write(mp4file.read())
|
||||
|
||||
print(
|
||||
" ➤ [[ PRESENTING FILE: "
|
||||
+ filename
|
||||
+ ", URL: https://fxtwitter.com/static/"
|
||||
+ ", URL: https://twxtter.com/static/"
|
||||
+ filename
|
||||
+ " ]]"
|
||||
)
|
||||
|
|
Reference in New Issue