Fix twitter not working on fresh installations
There was a problem with cache not being created
This commit is contained in:
parent
46fc7ae832
commit
53586d0195
@ -77,8 +77,10 @@ def twitter(page=0):
|
|||||||
posts = []
|
posts = []
|
||||||
|
|
||||||
cache_file = glob.glob("app/cache/{}_*".format(current_user.username))
|
cache_file = glob.glob("app/cache/{}_*".format(current_user.username))
|
||||||
|
if(len(cache_file) > 0):
|
||||||
time_diff = round(time.time()-os.path.getmtime(cache_file[0]))
|
time_diff = round(time.time()-os.path.getmtime(cache_file[0]))
|
||||||
|
else:
|
||||||
|
time_diff = 999
|
||||||
# If cache file is more than 1 minute old
|
# If cache file is more than 1 minute old
|
||||||
if page == 0 and time_diff > 60:
|
if page == 0 and time_diff > 60:
|
||||||
if cache_file:
|
if cache_file:
|
||||||
@ -663,6 +665,7 @@ def importYoutubeSubscriptions(file):
|
|||||||
def importYotterSubscriptions(file):
|
def importYotterSubscriptions(file):
|
||||||
filename = secure_filename(file.filename)
|
filename = secure_filename(file.filename)
|
||||||
data = json.load(file)
|
data = json.load(file)
|
||||||
|
print(data)
|
||||||
for acc in data['twitter']:
|
for acc in data['twitter']:
|
||||||
r = followTwitterAccount(acc['username'])
|
r = followTwitterAccount(acc['username'])
|
||||||
|
|
||||||
|
@ -259,8 +259,14 @@ def get_video_info(id):
|
|||||||
jsonIni = response[start:end1]
|
jsonIni = response[start:end1]
|
||||||
dataInitial = json.loads(jsonIni)
|
dataInitial = json.loads(jsonIni)
|
||||||
|
|
||||||
jsonDet = response[start2:end2]
|
try:
|
||||||
dataDetails = json.loads(jsonDet)
|
jsonDet = response[start2:end2]
|
||||||
|
dataDetails = json.loads(jsonDet)
|
||||||
|
except:
|
||||||
|
response = requests.get(url, headers=headers).json()
|
||||||
|
jsonDet = response[start2:end2]
|
||||||
|
dataDetails = json.loads(jsonDet)
|
||||||
|
|
||||||
|
|
||||||
#title, views, date
|
#title, views, date
|
||||||
videoInfo = get_video_primary_info(dataDetails, dataInitial)
|
videoInfo = get_video_primary_info(dataDetails, dataInitial)
|
||||||
|
Reference in New Issue
Block a user