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