Attempt to fix #107 (Cannot replicate locally)

This commit is contained in:
Dylan 2023-07-02 14:56:14 +01:00
parent 45f272f218
commit 8133482d49
3 changed files with 9 additions and 6 deletions

View File

@ -239,7 +239,7 @@ def test_directEmbed():
def test_message404():
resp = client.get("https://twitter.com/jack/status/12345",headers={"User-Agent":"test"})
assert resp.status_code==200
assert msgs.failedToScan in str(resp.data)
assert "Failed to scan your link!" in str(resp.data)
def test_combine():
twt,e = twitfix.vnfFromCacheOrDL(testMultiMediaTweet)

View File

@ -61,8 +61,11 @@ def oembedend():
@app.route('/<path:sub_path>') # Default endpoint used by everything
def twitfix(sub_path):
user_agent = request.headers.get('user-agent')
match = pathregex.search(sub_path)
if match is not None:
sub_path = match.group(0)
if request.url.endswith(".mp4") or request.url.endswith("%2Emp4"):
twitter_url = "https://twitter.com/" + sub_path

View File

@ -2,21 +2,21 @@ IS_DEBUG = False
def info(message):
message = str(message)
print(f" [ I ] {message}")
print(f" > [ I ] {message}")
def success(message):
message = str(message)
print(f" [ ✔ ] {message}")
print(f" > [ ✔ ] {message}")
def error(message):
message = str(message)
print(f" [ ✘ ] {message}")
print(f" > [ ✘ ] {message}")
def warn(message):
message = str(message)
print(f" [ ! ] {message}")
print(f" > [ ! ] {message}")
def debug(message):
if IS_DEBUG:
message = str(message)
print(f" [ D ] {message}")
print(f" > [ D ] {message}")