Use custom implementation of twitter API

This commit is contained in:
Dylan
2022-10-05 19:13:10 +01:00
parent 7ed13c3042
commit 148428e489
3 changed files with 46 additions and 4 deletions

View File

@ -4,7 +4,6 @@ from weakref import finalize
from flask import Flask, render_template, request, redirect, abort, Response, send_from_directory, url_for, send_file, make_response, jsonify
from flask_cors import CORS
import textwrap
from pkg_resources import ExtractionError
import requests
import re
import os
@ -206,8 +205,8 @@ def vnfFromCacheOrDL(video_link):
vnf = link_to_vnf(video_link)
addVnfToLinkCache(video_link, vnf)
return vnf,None
except ExtractorError as exErr:
if 'HTTP Error 404' in exErr.msg:
except (ExtractorError, twExtract.twExtractError.TwExtractError) as exErr:
if 'HTTP Error 404' in exErr.msg or 'No status found with that ID' in exErr.msg:
exErr.msg=msgs.tweetNotFound
elif 'suspended' in exErr.msg:
exErr.msg=msgs.tweetSuspended