diff --git a/templates/img.html b/templates/img.html new file mode 100644 index 0000000..b121089 --- /dev/null +++ b/templates/img.html @@ -0,0 +1,28 @@ +{% extends 'base.html' %} + +{% block head %} + + + + + + + +{% endblock %} + +{% block body %} + Redirecting you to the tweet in a moment. Or click here. +{% endblock %} diff --git a/twitfix.ini b/twitfix.ini index 6f0bf18..8a42cdc 100644 --- a/twitfix.ini +++ b/twitfix.ini @@ -2,7 +2,9 @@ module = wsgi:app master = true -processes = 5 +processes = 10 + +enable-threads = True socket = twitfix.sock chmod-socket = 660 diff --git a/twitfix.py b/twitfix.py index 6bf5520..edc63f0 100644 --- a/twitfix.py +++ b/twitfix.py @@ -23,9 +23,6 @@ import urllib.parse import urllib.request from datetime import date -class TwitterUserProtected(Exception): - pass - app = Flask(__name__) CORS(app) @@ -423,7 +420,7 @@ def dl(sub_path): print(" ➤ [[ FILE DOES NOT EXIST, DOWNLOADING... ]]") addToStat("downloads") mp4file = urllib.request.urlopen(mp4link) - with open(("/srv/Twxtter-main/static/" + filename), "wb") as output: + with open(("/home/twitfix/Twxtter-main/static/" + filename), "wb") as output: output.write(mp4file.read()) print( @@ -474,8 +471,6 @@ def direct_video(video_link): # Just get a redirect to a MP4 link from any twee addVnfToLinkCache(video_link, vnf) return redirect(vnf["url"], 301) print(" ➤ [ D ] Redirecting to direct URL: " + vnf["url"]) - except TwitterUserProtected: - return message("This user is guarding their tweets!") except Exception as e: print(e) return message("Failed to scan your link!") @@ -494,8 +489,6 @@ def direct_video_link( addVnfToLinkCache(video_link, vnf) return vnf["url"] print(" ➤ [ D ] Redirecting to direct URL: " + vnf["url"]) - except TwitterUserProtected: - return message("This user is guarding their tweets!") except Exception as e: print(e) return message("Failed to scan your link!") @@ -585,10 +578,6 @@ def link_to_vnf_from_api(video_link): tweet = twitter_api.statuses.show(_id=twid, tweet_mode="extended") # For when I need to poke around and see what a tweet looks like # print(tweet) - protected = tweet['user']['protected'] - if protected: - raise TwitterUserProtected() - text = tweet["full_text"] nsfw = tweet.get("possibly_sensitive", False) qrt = {} @@ -673,9 +662,6 @@ def link_to_vnf(video_link): # Return a VideoInfo object or die trying if config["config"]["method"] == "hybrid": try: return link_to_vnf_from_api(video_link) - except TwitterUserProtected: - print(" ➤ [ X ] User is protected, stop.") - raise except Exception as e: print(" ➤ [ !!! ] API Failed") print(e) @@ -683,9 +669,6 @@ def link_to_vnf(video_link): # Return a VideoInfo object or die trying elif config["config"]["method"] == "api": try: return link_to_vnf_from_api(video_link) - except TwitterUserProtected: - print(" ➤ [ X ] User is protected, stop.") - raise except Exception as e: print(" ➤ [ X ] API Failed") print(e)