Discuss Scratch

I-Animations-I
Scratcher
30 posts

scratchattach - A Scratch API wrapper (Python)

-FreeEngines- wrote:

il_GG wrote:

-FreeEngines- wrote:

il_GG wrote:

TimMcCool wrote:

il_GG wrote:

TimMcCool wrote:

il_GG wrote:

Does anyone know how to change scratch3.User objects into real usernames.

str(scratch3.User)
or
scratch.User.username
will return the username of the user.
it doesn't works writ the str(scratch3.User) i get only a number and whit scratch.User.username on syntax error
Can you give me your code? Then I can probably help you

Mein code ist
Follower = str(0x7f805f3a6ac0)
print(Follower)

Und als output bacam ich diese zahl 140189330205376

Das war der einzige befehl bei dem keine fehlermeldung kam.
ich hab versucht sie zu decodieren

Encoding.decode(Follower)

aber das ergab nur diese sinnlose buchstaben “5Nonenew”
was genau versuchst du denn zu machen?

ich versuche erst mal ein projekt zu machen in dem du all deine follower abrufen kannst und später vieleich ein projekt wie follgt TimMcCool dir (ähnlich wie does griffpatch follows you nur mit TimMcCool)
Das würde man so machen:
erst schaust du, wem tim folgt. dann nimmst du jede person, der er folgt, und schaust wem die person folgt. ich weiß garnicht ob scratchattach ein feature hat, um alle personen zu getten, denen sie folgt. fals ja, sollte das ja relativ klar sein.
der code wird jetzt nicht wirklich so im package sein, aber ungefähr wird das so aussehen (bin net gut in python, deshalb ist der code vermutlich weder akkurat noch funktional)
ˋˋˋimport scratchattach
tim_followers = scratchattach.get_following(“timmccool”)
for i in tim_followers:
print(scratchattach.get_following(tim_followers)) ##du würdest das in eine liste hinzufügen, und dass ganze so maximal 100 mal wiederholen, da dass logischerweise jedes mal exponentiell länger dauert. wie gesagt, der code funzt so NICHT, dass soll eher eine kleine logische inspiration sein.
whenclickedsayALL THIS IS SO CONFUSED!!!!
il_GG
Scratcher
31 posts

scratchattach - A Scratch API wrapper (Python)

-FreeEngines- wrote:

il_GG wrote:

-FreeEngines- wrote:

was genau versuchst du denn zu machen?

ich versuche erst mal ein projekt zu machen in dem du all deine follower abrufen kannst und später vieleich ein projekt wie follgt TimMcCool dir (ähnlich wie does griffpatch follows you nur mit TimMcCool)
Das würde man so machen:
erst schaust du, wem tim folgt. dann nimmst du jede person, der er folgt, und schaust wem die person folgt. ich weiß garnicht ob scratchattach ein feature hat, um alle personen zu getten, denen sie folgt. fals ja, sollte das ja relativ klar sein.
der code wird jetzt nicht wirklich so im package sein, aber ungefähr wird das so aussehen (bin net gut in python, deshalb ist der code vermutlich weder akkurat noch funktional)
ˋˋˋimport scratchattach
tim_followers = scratchattach.get_following(“timmccool”)
for i in tim_followers:
print(scratchattach.get_following(tim_followers)) ##du würdest das in eine liste hinzufügen, und dass ganze so maximal 100 mal wiederholen, da dass logischerweise jedes mal exponentiell länger dauert. wie gesagt, der code funzt so NICHT, dass soll eher eine kleine logische inspiration sein.
Genau so hab ich es gemacht nur das python die benuzer namen als scrach objekt angibt und ich es irgendwie nicht hinkriege die in benutzernamen umzuwandel.
wenn du nach scrachattach befehlen suchst hie ist eine seite mit eigentlich allen https://pypi.org/project/scratchattach/
und allgemein ist diese seit auch super defür wenn man was über python wissen willst

Last edited by il_GG (May 26, 2022 16:03:28)

TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

il_GG wrote:

-FreeEngines- wrote:

il_GG wrote:

-FreeEngines- wrote:

was genau versuchst du denn zu machen?

ich versuche erst mal ein projekt zu machen in dem du all deine follower abrufen kannst und später vieleich ein projekt wie follgt TimMcCool dir (ähnlich wie does griffpatch follows you nur mit TimMcCool)
Das würde man so machen:
erst schaust du, wem tim folgt. dann nimmst du jede person, der er folgt, und schaust wem die person folgt. ich weiß garnicht ob scratchattach ein feature hat, um alle personen zu getten, denen sie folgt. fals ja, sollte das ja relativ klar sein.
der code wird jetzt nicht wirklich so im package sein, aber ungefähr wird das so aussehen (bin net gut in python, deshalb ist der code vermutlich weder akkurat noch funktional)
ˋˋˋimport scratchattach
tim_followers = scratchattach.get_following(“timmccool”)
for i in tim_followers:
print(scratchattach.get_following(tim_followers)) ##du würdest das in eine liste hinzufügen, und dass ganze so maximal 100 mal wiederholen, da dass logischerweise jedes mal exponentiell länger dauert. wie gesagt, der code funzt so NICHT, dass soll eher eine kleine logische inspiration sein.
Genau so hab ich es gemacht nur das python die benuzer namen als scrach objekt angibt und ich es irgendwie nicht hinkriege die in benutzernamen umzuwandel.
wenn du nach scrachattach befehlen suchst hie ist eine seite mit eigentlich allen https://pypi.org/project/scratchattach/
und allgemein ist diese seit auch super defür wenn man was über python wissen willst
Um ein scratch3.User Objekt in einen Benutzernamen umzuwandeln, benutze entweder “str(user)” oder “user.username”

Last edited by TimMcCool (May 26, 2022 18:29:25)

hubblefam
Scratcher
45 posts

scratchattach - A Scratch API wrapper (Python)

the scratch-side cloud requests link https://scratch3-assets.1tim.repl.co/Encoder.sprite3 is blocked for me. is there a way i can download it from a different source?
-FreeEngines-
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

hubblefam wrote:

the scratch-side cloud requests link https://scratch3-assets.1tim.repl.co/Encoder.sprite3 is blocked for me. is there a way i can download it from a different source?
what does it say when you try to clic on taht link?
TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

hubblefam wrote:

the scratch-side cloud requests link https://scratch3-assets.1tim.repl.co/Encoder.sprite3 is blocked for me. is there a way i can download it from a different source?
You can download it from the GitHub repo: https://github.com/TimMcCool/scratchattach/blob/main/assets/Encoder.sprite3
youhan_school
Scratcher
41 posts

scratchattach - A Scratch API wrapper (Python)

ok.

Last edited by youhan_school (May 27, 2022 06:10:57)

-FreeEngines-
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

please no off topic, thanks
il_GG
Scratcher
31 posts

scratchattach - A Scratch API wrapper (Python)

TimMcCool wrote:

il_GG wrote:

Genau so hab ich es gemacht nur das python die benuzer namen als scrach objekt angibt und ich es irgendwie nicht hinkriege die in benutzernamen umzuwandel.
wenn du nach scrachattach befehlen suchst hie ist eine seite mit eigentlich allen https://pypi.org/project/scratchattach/
und allgemein ist diese seit auch super defür wenn man was über python wissen willst
Um ein scratch3.User Objekt in einen Benutzernamen umzuwandeln, benutze entweder “str(user)” oder “user.username”
Bei dem “str(user)” befehl kommt nur eine lange zahl und bei “user.username” diese fehlermeldung “ ‘int’ object has no attribute ‘username’ ”

Last edited by il_GG (May 27, 2022 08:59:15)

-FreeEngines-
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

il_GG wrote:

TimMcCool wrote:

il_GG wrote:

Genau so hab ich es gemacht nur das python die benuzer namen als scrach objekt angibt und ich es irgendwie nicht hinkriege die in benutzernamen umzuwandel.
wenn du nach scrachattach befehlen suchst hie ist eine seite mit eigentlich allen https://pypi.org/project/scratchattach/
und allgemein ist diese seit auch super defür wenn man was über python wissen willst
Um ein scratch3.User Objekt in einen Benutzernamen umzuwandeln, benutze entweder “str(user)” oder “user.username”
Bei dem “str(user)” befehl kommt nur eine lange zahl und bei “user.username” diese fehlermeldung “ ‘int’ object has no attribute ‘username’ ”
Dann hast du user nicht wirklich deklariert. was ist dein code um das user objekt zu getten?
il_GG
Scratcher
31 posts

scratchattach - A Scratch API wrapper (Python)

der derzeitige code ist das die user.objekte trägt er dann in eine tabele in scrach ein scrach seperriert dann den code und schickt ihn an python damit python ihn in einen benutzernamen umwandeln und zurück schicken kann. (leider erhält python den code wegen irgend etwas noch nicht deswegen hab ich irgend einen einfach für die tests nach python copiert)

def foo(argument1):
print(f“Data requested for user {argument1}”)
user = scratch3.get_user(argument1)
return_data =
follower = 1
for i in range(user.follower_count()):
return_data.append(user.followers(limit=1, offset=follower))
follower += 1
follower = 1
return return_data

wenn python das objekt erhalten würde wandelt es es z.b. so um
argument1 ist in dem fall das user.objekt
def user(argument1):
print(u“Data requested for decode of {argument1}”)
return_data =
User = str(argument1)
print(User)
return_data.append(User)
return return_data

Last edited by il_GG (May 27, 2022 09:38:58)

TimMcCool
Scratcher
100+ posts

scratchattach - A Scratch API wrapper (Python)

New features in v0.5.2:
- Inviting, promoting and removing curators from studios
- Adding and removing projects from studios
- Getting the studios a Scratcher is curating
- Getting your backpack and removing assets from your backpack
- Getting someone's follower count history (“followers over time”)
lalusangani
Scratcher
21 posts

scratchattach - A Scratch API wrapper (Python)

whenclickedaskhow do u connect python to scratch?andwait
kccuber
Scratcher
1000+ posts

scratchattach - A Scratch API wrapper (Python)

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.
youhan_school
Scratcher
41 posts

scratchattach - A Scratch API wrapper (Python)

TimMcCool wrote:

New features in v0.5.2:
- Inviting, promoting and removing curators from studios
- Adding and removing projects from studios
- Getting the studios a Scratcher is curating
- Getting your backpack and removing assets from your backpack
- Getting someone's follower count history (“followers over time”)
OK!!! thank you for the new features
Privat2012
Scratcher
19 posts

scratchattach - A Scratch API wrapper (Python)

My Pyhton stopping on start. :
-FreeEngines-
Scratcher
100+ posts

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

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)

Dinosu
Scratcher
82 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!

Powered by DjangoBB