Skip to main content

Scratch API wrapper

Project description

scratchhh

img img

scratch

scratchhh is a kinda thin wrapper for the Scratch API. It makes things easier to fetch and use.

Installation

With pip:

python -m pip install scratchhh

Or manually:

python setup.py install

Usage

getUserProj

# Get projects from a specific user
from scratchhh.scratchhh import Scratch
Scratch.getUserProj(user, num)

getThumb

# Get a project thumbnail
from scratchhh.scratchhh import Scratch
Scratch.getThumb(id, url, file)

searchProj

# Search for projects
from scratchhh.scratchhh import Scratch
Scratch.searchProj(query, num)

getInfo

# Get project information
from scratchhh.scratchhh import Scratch
Scratch.getInfo(id)

getUserAv

# Get a user avatar
from scratchhh.scratchhh import Scratch
Scratch.getUserAv(user, url, file)

exists

# Check if a user or project exists
from scratchhh.scratchhh import Scratch
Scratch.getUserAv(ini)

getProjComments

# Get project comments
from scratchhh.scratchhh import Scratch
Scratch.getProjComments(id, num)

getUserComments

# Get user comments
from scratchhh.scratchhh import Scratch
Scratch.getProjComments(user, num)

cloneProj

# Get a project as an sb3 file
from scratchhh.scratchhh import Scratch
Scratch.cloneProj(id, file)

More features will be added as project development moves!

Examples

from scratchhh.scratchhh import Scratch
import os

ids = Scratch.getUserProj('Scratchteam', 10)
print('Getting some thumbnails :P')
os.chdir('thumbs')

for i in range(0, 10):
  Scratch.getThumb(ids[i], 'thumbnail{}.png'.format(i))
from scratchhh.scratchhh import Scratch

project = Scratch.searchProj('minecraft', 1)[0]
loves = Scratch.getInfo(project)['stats']['loves']

print('This project has {} loves. WOW!'.format(loves))
from scratchhh.scratchhh import Scratch

users = ['Za-Chary', 'Scratchteam', 'Paddle2See']
print('Getting some user pfps...')

for i in range(0, len(users)):
  Scratch.getUserAv(users[i], '{}.png'.format(users[i]))
from scratchhh.scratchhh import Scratch

ids = ['658095', '142', '943855']

for i in range(0, len(ids)):
  print(Scratch.getProjComments(ids[i], 3))

Why scratchhh?

scratchhh offers simpler command syntax and results and a few more features than other modules, I guess.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scratchhh-0.2.72.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

scratchhh-0.2.72-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page