there is a function sess.mystuff_projects determined by page. but there is no function to get the number of projects.
here is an external implementation:
def session_mystuff_counts(self: sa.Session) -> tuple[int, int, int]:
# returns shared count, unshared count, and studio count
# TODO: classrooms?
resp = requests.get(
"https://scratch.mit.edu/mystuff/", headers=self._headers, cookies=self._cookies
)
soup = bs4.BeautifulSoup(resp.text, "html.parser")
shared_elem = soup.select_one("span[data-content='shared-count']")
unshared_elem = soup.select_one("span[data-content='unshared-count']")
gallery_elem = soup.select_one("span[data-content='gallery-count']")
assert shared_elem is not None
assert unshared_elem is not None
assert gallery_elem is not None
shared: str = shared_elem.text.strip()
unshared: str = unshared_elem.text.strip()
gallery: str = gallery_elem.text.strip()
return int(shared), int(unshared), int(gallery)
there is a function
sess.mystuff_projectsdetermined by page. but there is no function to get the number of projects.here is an external implementation: