namespace the refs for hn and substack.

This commit is contained in:
Jason Schwarzenberger
2020-11-23 16:09:12 +13:00
parent 54a4c7e55a
commit c1b6349771
2 changed files with 22 additions and 3 deletions
+2 -1
View File
@@ -40,7 +40,7 @@ def api(route, ref=None):
return False
def feed():
return [str(x) for x in api(API_TOPSTORIES) or []]
return ['hn:'+str(x) for x in api(API_TOPSTORIES) or []]
def comment(i):
if 'author' not in i:
@@ -60,6 +60,7 @@ def comment_count(i):
return sum([comment_count(c) for c in i['comments']]) + alive
def story(ref):
ref = ref.replace('hn:', '')
r = api(API_ITEM, ref)
if not r: return False