ScrapingSession¶
Used to scrape data that isn't provided cleanly by Scratch's website.
Methods¶
get_follower_count(user)
¶
Gets the follower count of a user.
PARAMETERS
- user (
User | IncompleteUser | str
) - The username of the user you want to retrieve the follower count of, or a corresponding object representing them.
RETURNS - int
get_following_count(user)
¶
Gets the number of users that a user is following.
PARAMETERS
- user (
User | IncompleteUser | str
) - The username of the user you want to retrieve the following count of, or a corresponding object representing them.
RETURNS - int
get_favorited_count(user)
¶
Gets the number of projects that a user has favorited.
PARAMETERS
- user (
User | IncompleteUser | str
) - The username of the user you want to retrieve the favorite count of, or a corresponding object representing them.
RETURNS - int
get_followed_studios_count(user)
¶
Gets the number of studios that a user has followed.
PARAMETERS
- user (
User | IncompleteUser | str
) - The username of the user you want to retrieve the followed studios count of, or a corresponding object representing them.
RETURNS - int
get_curated_studios_count(user)
¶
Gets the number of studios that a user curates.
PARAMETERS
- user (
User | IncompleteUser | str
) - The username of the user you want to retrieve the curated studios count of, or a corresponding object representing them.
RETURNS - int
get_shared_projects_count(user)
¶
Gets the number of projects that a user has shared.
PARAMETERS
- user (
User | IncompleteUser | str
) - The username of the user you want to retrieve the shared project count of, or a corresponding object representing them.
RETURNS - int
get_user_activity(user, max=100000)
¶
Retrieves a user's activity as an array of Activity objects.
PARAMETERS
- user (
User | IncompleteUser | str
) - The username of the user you want to retrieve the activity of, or a corresponding object representing them. - max (
int
) - The maximum amount of items you want to retrieve. Note that there is no harm in making this absurdly large, since user activity from before a year ago is not available.
RETURNS - list[Activity]
Example:
print(session.scraping.get_user_activity("griffpatch", max=1)[0].actor)
# griffpatch
get_profile_comments(user, all=False, page=1)
¶
Gets a list of comments on a user's profile as an array of ProfileComment objects.
PARAMETERS
- user (
User | IncompleteUser | str
) - The username of the user you want to retrieve the profile comments of, or a corresponding object representing them. - all (
bool
) - Whether to retrieve all of the user's comments or just one page of them. - page (
page
) - Ifall
isFalse
, this is the page of profile comments to retrieve.
RETURNS - list[ProfileComment]
Example:
print(session.scraping.get_profile_comments("griffpatch")[0].content)
# Follow me please
get_signature(post_id, as_html=False)
¶
Gets the signature at the bottom of a forum post with the specified ID.
PARAMETERS
- post_id (
int
) - The ID of the post you want to retrieve the signature from. - as_html (
bool
) - Whether you want the response in HTML or in BBCode. By default, the response is converted to BBCode.
RETURNS - str
Example:
print(session.scraping.get_signature(5154718))
# I use scratch.
# GF: I'll dump you. BF: hex dump or binary dump?
# ...