Skip to content

Commit 1f066f1

Browse files
committed
fixed edge case
1 parent 9d9f567 commit 1f066f1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scratchattach/site/user.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,13 @@ def loves_count(self):
375375
headers=self._headers
376376
).text
377377

378+
# If there are no loved projects, then Scratch doesn't actually display the number - so we have to catch this
379+
soup = BeautifulSoup(text, "html.parser")
380+
381+
if not soup.find("li", {"class": "project thumb item"}):
382+
# There are no projects, so there are no projects loved
383+
return 0
384+
378385
return commons.webscrape_count(text, "»\n\n (", ")")
379386

380387
def favorites(self, *, limit=40, offset=0):

0 commit comments

Comments
 (0)