apply fix for json parse error
This commit is contained in:
parent
f1037d888d
commit
a9ea094144
@ -119,11 +119,15 @@ class Getter:
|
||||
"""
|
||||
r = requests.get(self.url)
|
||||
if r.status_code == 200:
|
||||
j = r.json()
|
||||
for t in j['threads']:
|
||||
posts = t['posts']
|
||||
for post in posts:
|
||||
yield Article(post, self.board, self.site)
|
||||
try:
|
||||
j = r.json()
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
for t in j['threads']:
|
||||
posts = t['posts']
|
||||
for post in posts:
|
||||
yield Article(post, self.board, self.site)
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user