Discuss Scratch

MarioBrosU22
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (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 (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)


Developer of scratchattach, the most popular Python Scratch API wrapper
Dinosu
Scratcher
76 posts

scratchattach - A Scratch API wrapper (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 (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)


Developer of scratchattach, the most popular Python Scratch API wrapper
-Krios-
Scratcher
96 posts

scratchattach - A Scratch API wrapper (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 (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 (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 (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

Developer of scratchattach, the most popular Python Scratch API wrapper
TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)


Developer of scratchattach, the most popular Python Scratch API wrapper
TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (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)


Developer of scratchattach, the most popular Python Scratch API wrapper
god286
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

TimMcCool wrote:

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

Here are some of my followers!

I joined: 5 years, 9 months, 24 days ago (31/03/2018)
I have: 479 followers
In total, I have attained: 1,403 loves, 1,145 favourites, and 33,731 views.
Fun Fact: If my account continued to gain followers at a similar rate to right now, in 14,210 years I would reach the number of followers griffpatch has today! Try to imagine how many followers he would have then!
Thank you everyone!
Script created by god286.
Joshisaurio
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (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 (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 (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…

Hello!
PoIygon
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (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 (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 (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)


(Thanks to butterfly_cat8 for part of the thumbnail for Cat TV used in this banner.)

Suggest purple things on my profile I can feed to Cat Posts, Cat Comments, Cat Replies or even better the Cat Profile in the link.
youhan_school
Scratcher
41 posts

scratchattach - A Scratch API wrapper (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 (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 ).

MarioBrosU22
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

Imma ask again but why does the stats() function only return followers and following stats for some users?
Test my username on it

Hi its me

Powered by DjangoBB