Giter Club home page Giter Club logo

python-scratch-api's Introduction

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())

python-scratch-api's People

Contributors

itzsten avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.