Skip to content

Itzsten/Python-Scratch-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 

Repository files navigation

Python-Scratch-API

A Python script to interact with the Scratch API.

Start by downloading the Scratch.py file, and make sure you have the library "requests" installed on your device.

Users

Let's start by setting a User variable!

from scratch import *
user = User('griffpatch')

Now, let's say we wanted the profile picture.

link = user.profilepicture()

This gives us the following:

https://cdn2.scratch.mit.edu/get_image/user/1882674_90x90.png?v=

Which represents a link to the users profile picture!

So, how do we check if a user is in Scratchteam? Well, we can do that by using the following:

print(User('griffpatch').scratchteam()) # False
print(User('Za-Chary').scratchteam())   # True

Get User ID:

print(User('griffpatch').id()) # 1882674 (User ID of griffpatch)

You can also get users from links:

linkuser = User('https://scratch.mit.edu/griffpatch/')
normal = User('griffpatch')
# These to work exactly the same.

Get exact username:

user = User('GrIfFpAtCh')
print(user.exactUsername()) # griffpatch

Get joindate of user:

user = User('griffpatch')
print(user.joindate()) # 2012-10-24T12:59:31.000Z

Get status of user:

print(User('mref').status())

Get bio of user:

print(User('mref').bio())

Get country of user:

print(User('griffpatch').country())

Get a list of usernames that the user follows:

print(User('mref').following())

Get the amount of users the user follows:

print(User('mref').followingCount())

Get a list of usernames that follows the user:

print(User('mref').followers())

Get follower count:

print(User('mref').followersCount())

Get list of Project ID's that the user made:

print(User('griffpatch').projects())

Get the amounts of projects the user made:

print(User('griffpatch').projectsCount())

Get link of user

print(User('griffpatch').link())

Get list of project ID's marked as favorite from user:

print(User('mref').favorites())

Projects

Let's start by setting a project variable! We can use both links and ID's.

project = Project('https://scratch.mit.edu/projects/501406149/') # You can use links or the last number (Project ID (501406149 in this case))

Let's get the title!

print(project.title()) # In the Sky - Platformer

Let's get the description!

print(project.description()) # ...

Get link of project

print(Project('501406149').link())

Let's get the instructions!

print(project.instructions()) # ...

Let's see if a project is visible!

print(project.visibility()) # True

Check if a project is public!

print(project.public()) # True

Check if comments is allowed on a project!

print(project.commentsAllowed()) # True

Let's see who made the project!

print(project.author()) # Geometrysten2

Let's get the projects thumbnail!

print(project.thumbnail()) # (link to thumbnail)

Let's see when the project was created!

print(project.created())

Let's see when the project was shared publicly!

print(project.shared())

Let's see when the last time that the project was modified!

print(project.modified())

Let's get the projects amount of views!

print(project.views())

Let's get the projects amount of favorites!

print(project.favorites())

Let's get the projects amount of loves!

print(project.loves())

Let's get the projects amount of remixes!

print(project.remixesCount())

Let's get the remixes projects ID's!

print(project.remixes())

Let's check if a project exists!

print(Project.exists(50305)) # False

Let's check the latest projects posted!

print(Project.latestprojects())

Scratch Main

Get Scratch website:

print(Scratch.website())

Get Scratch API:

print(Scratch.api())

Get Scratch help E-Mail:

print(Scratch.help())

Releases

No releases published

Packages

No packages published

Languages