Discuss Scratch

-FreeEngines-
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

kccuber wrote:

TimMcCool wrote:

- Inviting, promoting and removing curators from studios
Please don't. This will increase auto invite spam and strain the servers. There's a reason why the Scratch Team removed the “Invite All Followers” button.
theres a pretty high cooldown or inviting people, so that wont happen. also anyone with just a little knowledge of the scratch api could write that himself
MarioBrosU22
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

I used my session id to log in and I get this warn
Logged in, but couldn't fetch XToken, some features may not work properly

I use replit for the hosting
Another thing i've noticed is for the stats() function, sometimes it only returns “following” and “followers”

Last edited by MarioBrosU22 (May 28, 2022 07:18:54)


Hi its me
TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

MarioBrosU22 wrote:

I used my session id to log in and I get this warn
Logged in, but couldn't fetch XToken, some features may not work properly

I use replit for the hosting
Another thing i've noticed is for the stats() function, sometimes it only returns “following” and “followers”

Try connecting to the cloud directly with your sessionid (cookie connect):

import scratchattach as scratch3
conn = scratch3.CloudConnection(project_id = "project_id", username="username", session_id="sessionId")

Another fix would be to provide the username when logging in with your session id:

import scratchattach as scratch3
session = scratch3.Session("sessionId", username="username")
conn = session.connect_cloud(project_id="project_id")

Last edited by TimMcCool (May 28, 2022 10:52:57)


My profile / Mein Profil: @TimMcCool
Dinosu
Scratcher
68 posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

I apologize if this has already been mentioned before.

The User.is_following or is_followed_by function can be slow if the user in question is following many people, and, judging by your Replit following check API, It looks like this is because it has to check through thousands of people if that is how many people are being followed by the focus user.

If you think it would in fact make the function faster, could you please update the Replit code so that if someone does https://following-check.1tim.repl.co/api/personA/?following=personB, it checks through personA's followings if personA is following less people than personB's follower count, but it checks through personB's followers if personA is following more people than personB has followers?

Thanks in advance!
TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

Dinosu wrote:

I apologize if this has already been mentioned before.

The User.is_following or is_followed_by function can be slow if the user in question is following many people, and, judging by your Replit following check API, It looks like this is because it has to check through thousands of people if that is how many people are being followed by the focus user.

If you think it would in fact make the function faster, could you please update the Replit code so that if someone does https://following-check.1tim.repl.co/api/personA/?following=personB, it checks through personA's followings if personA is following less people than personB's follower count, but it checks through personB's followers if personA is following more people than personB has followers?

Thanks in advance!
I just implemented that, thanks for the suggestion. However it only makes the function faster for Scratchers who are following significantly more people than they have followers. For other people (I would say most people) it makes the function slighty slower because it now has to perform two additional requests (to get the follower / following counts).

Last edited by TimMcCool (May 28, 2022 14:19:58)


My profile / Mein Profil: @TimMcCool
-Krios-
Scratcher
95 posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

Now make a JS library

Hello! The (User)name's -Krios-!

I mostly create engines and animations, but sometimes you'll find some art or a game too!

Check out The Block Shop! A custom block for all your needs! We get them done fast and for free!
-FreeEngines-
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

-Krios- wrote:

Now make a JS library
there are actually a few JS libaries for it, but none have so good cloud requests (checkout scratchinteract for a very poorly package using deprecated packagages and no asyn functions ) yeah i made my own bacakage a while ago, i think im gonna rewrite it sometime soon.. scratch3api is a good package for nodejs tho)
kccuber
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

-FreeEngines- wrote:

-Krios- wrote:

Now make a JS library
there are actually a few JS libaries for it, but none have so good cloud requests (checkout scratchinteract for a very poorly package using deprecated packagages and no asyn functions ) yeah i made my own bacakage a while ago, i think im gonna rewrite it sometime soon.. scratch3api is a good package for nodejs tho)
meowclient is also a good one from what I've heard


Made using Nord Theme & Inkscape
TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

New in v0.5.4:
- Added a function that lets you see the moderation status of a project (safe, notsafe (nfe) or notreviewed)
- Added functions for a user's forum counts, forum stats and forum signature

Coming soon:
- Cloud requests for TurboWarp
- A class for forum topics

My profile / Mein Profil: @TimMcCool
TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)


My profile / Mein Profil: @TimMcCool
TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

New in v0.5.5:


- Getting and following Forum Topics (new scratch3.ForumTopic class)
- Getting list of the forum topics in a category
- Getting forum topic change log

- Getting and editing Forum Posts (new scratch3.ForumPost class)
- Getting forum posts of a topic
- Searching forum posts all over Scratch
- Getting the forum posts made by a user

- Getting a post's ocular reactions
- Getting a user's ocular status

- Getting site statistics (from https://scratch.mit.edu/statistics/)
- Getting site health

If you find any bugs in the new features, please report them.

Last edited by TimMcCool (May 29, 2022 15:50:05)


My profile / Mein Profil: @TimMcCool
god286
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

TimMcCool wrote:

(test post so I can implement posts in scratchattach)
Automated posts are not allowed?


      
** ******** ** **
/** **////// // ****** /**
/** ****** ** ** ****** /** ***** ****** **/**///** ******
/** //////** /** /** //////** /********* **///**//**//*/**/** /**///**/
/** ******* //** /** ******* ////////**/** // /** / /**/****** /**
** /** **////** //**** **////** /**/** ** /** /**/**/// /**
//***** //******** //** //******** ******** //***** /*** /**/** //**
///// //////// // //////// //////// ///// /// // // //
Above inspired by @ISTILLMAKESTUFF, made with duckduckgo search “figlet 3d JavaScript”
Joshisaurio
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

youhan_school wrote:

Joshisaurio wrote:

-FreeEngines- wrote:

Joshisaurio wrote:

Joshisaurio wrote:

How do you even get your session ID?
Why doesn't anyone answer?
sorry answering late, idk if this got answered aready.
when making an post request to https://scratch.mit.edu/login with {username, password} in the request body, the response the server returns contains the session id in the cookie at
caseless.dict // this returns the cookie header which you then have to extract the value from
Thx but how do you get it in Python? I mean I don't get it I only know how to code in Python
See the ref document
Link pls?


Banner by @NFlex23


Banner by @NFlex23

Joshisaurio
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

TimMcCool wrote:

(test post so I can implement posts in scratchattach)
Second quote to tim yay


Banner by @NFlex23


Banner by @NFlex23

Sid72020123
Scratcher
500+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

TimMcCool wrote:

(test post so I can implement posts in scratchattach)
Using this feature can be used to spam the forums by other users…

Don't run this code in Python:
import os
try:
    import scratchconnect
except ModuleNotFoundError:
    os.system("pip install scratchconnect[terminal]")
    import scratchconnect
login = scratchconnect.ScratchConnect()
terminal = login.create_new_terminal()
terminal.start()

PoIygon
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

TimMcCool wrote:

(test post so I can implement posts in scratchattach)
Yes I can finally spam the forums easier

Last edited by PoIygon (May 29, 2022 04:01:15)




infintyrussia
Scratcher
100+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

Is it just me or is “studio = session.connect_studio(”id“)” broken?

Error message:
Message='Session' object has no attribute ‘connect_studio’


scratchgodo
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

god286 wrote:

TimMcCool wrote:

(test post so I can implement posts in scratchattach)
Automated posts are not allowed?
Probably there not allowed because of spam

Last edited by scratchgodo (May 29, 2022 06:10:01)


The cat blocks will eat all signatures not kumquats well I gave this one some signatures but there is more that will eat a signature when a signature is seen: credits in the image.
youhan_school
Scratcher
41 posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

TimMcCool wrote:

New in v0.5.4:
- Added a function that lets you see the moderation status of a project (safe, notsafe (nfe) or notreviewed)
- Added functions for a user's forum counts, forum stats and forum signature

Coming soon:
- Cloud requests for TurboWarp
- A class for forum topics
ok
youhan_school
Scratcher
41 posts

scratchattach - A Scratch API wrapper | v1.0 released (Python)

Joshisaurio wrote:

youhan_school wrote:

Joshisaurio wrote:

-FreeEngines- wrote:

Joshisaurio wrote:

Joshisaurio wrote:

How do you even get your session ID?
Why doesn't anyone answer?
sorry answering late, idk if this got answered aready.
when making an post request to https://scratch.mit.edu/login with {username, password} in the request body, the response the server returns contains the session id in the cookie at
caseless.dict // this returns the cookie header which you then have to extract the value from
Thx but how do you get it in Python? I mean I don't get it I only know how to code in Python
See the ref document
Link pls?
Here you go!
The package is available on PyPi (Link: https://pypi.org/project/scratchattach/ ) and on GitHub (Link: https://github.com/TimMcCool/scratchattach ).

Powered by DjangoBB

Standard | Mobile