aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHygna <hygna@proton.me>2022-10-06 11:12:35 +0100
committerHygna <hygna@proton.me>2022-10-06 11:12:35 +0100
commit3bd83642f367d1b27d1acfa7ebd4ef6ba7116fcb (patch)
tree56c416bdf8dd2c3b4f09cf7991042c5e51c4d7c5
parentFixed Libreddit and LibreX instance fetching (diff)
downloadlibredirect-3bd83642f367d1b27d1acfa7ebd4ef6ba7116fcb.zip
Made peertube instance list use cache if it fails
Diffstat (limited to '')
-rw-r--r--src/instances/get_instances.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/instances/get_instances.py b/src/instances/get_instances.py
index f0fa8496..2f3c75dc 100644
--- a/src/instances/get_instances.py
+++ b/src/instances/get_instances.py
@@ -442,16 +442,19 @@ def breezeWiki():
def peertube():
- r = requests.get(
- 'https://instances.joinpeertube.org/api/v1/instances?start=0&count=1045&sort=-createdAt')
- rJson = json.loads(r.text)
+ try:
+ r = requests.get(
+ 'https://instances.joinpeertube.org/api/v1/instances?start=0&count=1045&sort=-createdAt')
+ rJson = json.loads(r.text)
- myList = ['https://search.joinpeertube.org']
- for k in rJson['data']:
- myList.append('https://'+k['host'])
+ myList = ['https://search.joinpeertube.org']
+ for k in rJson['data']:
+ myList.append('https://'+k['host'])
- mightyList['peertube'] = myList
- print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'PeerTube')
+ mightyList['peertube'] = myList
+ print(Fore.GREEN + 'Fetched ' + Style.RESET_ALL + 'PeerTube')
+ except Exception:
+ fetchCache('peertube', 'PeerTube')
def isValid(url): # This code is contributed by avanitrachhadiya2155