Fix Better HN api content extraction

This commit is contained in:
Tanner Collin 2025-02-01 22:39:13 +00:00
parent 4858516b01
commit bdc7a6c10d

View File

@ -131,7 +131,7 @@ def bhn_story(ref):
s['num_comments'] = r.get('comments_count', 0) s['num_comments'] = r.get('comments_count', 0)
if 'content' in r and r['content']: if 'content' in r and r['content']:
s['text'] = clean(r['text'] or '') s['text'] = clean(r['content'] or '')
return s return s
@ -157,4 +157,6 @@ if __name__ == '__main__':
#print(story(42899834)) # type "job" #print(story(42899834)) # type "job"
#print(story(42900076)) # Ask HN #print(story(42900076)) # Ask HN
print(story(42899703)) # normal #print(story(42898201)) # Show HN
#print(story(42899703)) # normal
print(story(42902678)) # bad title?