RemixtreeProject¶
A class that represents the project data that is used on Scratch's remix tree page.
Properties¶
title : str
¶
The title of the project.
id : int
¶
The project ID of the project.
author : str
¶
The username of the project's creator.
An IncompleteProject
might have other attributes depending on where it came from:
moderation_status : str
¶
The moderation status of the project. This is either "notreviewed"
or "notsafe"
. If it is "notsafe"
(NSFE), this means the project can't show up in search results, the front page, or the trending page.
Example:
def is_nsfe(project_id):
remixtree = session.get_project(project_id).get_remixtree()
try:
remixtree_project = next(project for project in remixtree if project.id == project_id)
except StopIteration:
# It's unknown since the project has no remix tree
return False
return remixtree_project.moderation_status == "notsafe"
print(is_nsfe(414601586))
# True
Fun-fact
Although you can easily determine whether a project is NSFE using this, you are not allowed to mention how to do this or say that a project is NSFE on Scratch. It's weird that they still include this in an API response, though. Just think of it as a little Easter Egg in Scratch's API.
visible : bool
¶
A boolean value representing whether the project has been deleted or not.
is_published : bool
¶
A boolean value representing whether the project has been shared or not.
love_count : int
¶
The number of loves the project has.
favorite_count : int
¶
The number of favorites the project has.
created_timestamp : int
¶
A Unix timestamp representing the date the project was created.
Example:
import datetime
def unix_to_readable(unix):
timezone = datetime.datetime.now(datetime.timezone.utc).astimezone().tzinfo
date = datetime.datetime.fromtimestamp(unix)
date.astimezone(timezone)
return date.strftime("%Y-%m-%d %I:%M %p")
project_104 = next(project for project in
session.get_project(104).get_remix_tree() if project.id == 104)
print(unix_to_readable(project_104.created_timestamp))
# 2007-03-05 10:47 AM
last_modified_timestamp : int
¶
A Unix timestamp timestamp representing the date the project was most recently modified.
shared_timestamp : int | None
¶
A Unix timestamp timestamp representing the date the project was shared.
parent_id : int | None
¶
If the project is a remix, this is the ID of the project's parent project. Otherwise, it's None
.
children : list[int]
¶
A list of the project IDs of the project's remixes.
Note
This can be used to determine the project's remixes much more quickly than Project.get_remixes
.