| 679 | return _projects |
| 680 | |
| 681 | def loves_count(self): |
| 682 | with requests.no_error_handling(): |
| 683 | text = requests.get( |
| 684 | f"https://scratch.mit.edu/projects/all/{self.username}/loves/", |
| 685 | headers=self._headers, |
| 686 | ).text |
| 687 | |
| 688 | # If there are no loved projects, then Scratch doesn't actually display the number - so we have to catch this |
| 689 | soup = BeautifulSoup(text, "html.parser") |
| 690 | |
| 691 | if not soup.find("li", {"class": "project thumb item"}): |
| 692 | # There are no projects, so there are no projects loved |
| 693 | return 0 |
| 694 | |
| 695 | return commons.webscrape_count(text, "»\n\n (", ")") |
| 696 | |
| 697 | def favorites(self, *, limit=40, offset=0): |
| 698 | """ |