From 9e55f6e4ec312ed20d017488fd876f30328ef3e0 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Tue, 22 Oct 2019 05:01:30 +0000 Subject: [PATCH] Fix Tildes down for maintenance edge case --- apiserver/feeds/tildes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apiserver/feeds/tildes.py b/apiserver/feeds/tildes.py index c3c8e56..cab4395 100644 --- a/apiserver/feeds/tildes.py +++ b/apiserver/feeds/tildes.py @@ -67,6 +67,8 @@ def story(ref): soup = BeautifulSoup(html, features='html.parser') a = soup.find('article', class_='topic-full') + if a is None: return False + h = a.find('header') lu = h.find('a', class_='link-user') @@ -112,7 +114,7 @@ if __name__ == '__main__': #print(self_post) #li_comment = story('gqx') #print(li_comment) - broken = story('hsg') + broken = story('ikn') print(broken) # make sure there's no self-reference