Discuss Scratch

EncloCreations
Scratcher
500+ posts

API link to follow someone?

does anyone know a link that follows someone just by typing that link?
i tried: https://scratch.mit.edu/site-api/followers/user/ (Insert any username here)/add

Last edited by EncloCreations (Dec. 24, 2015 15:58:01)

Zro716
Scratcher
1000+ posts

API link to follow someone?

https://scratch.mit.edu/site-api/followers/user/username-to-follow/add/

You had the right link, you're just missing the / at the end.
EncloCreations
Scratcher
500+ posts

API link to follow someone?

Zro716 wrote:

https://scratch.mit.edu/site-api/followers/user/username-to-follow/add/

You had the right link, you're just missing the / at the end.
ahh thx mate (Sorry for the newbie question)
EncloCreations
Scratcher
500+ posts

API link to follow someone?

Zro716 wrote:

https://scratch.mit.edu/site-api/followers/user/username-to-follow/add/

You had the right link, you're just missing the / at the end.
hmm its not working
ev3coolexit987654
Scratcher
1000+ posts

API link to follow someone?

It has to be a POST request not a GET request
EncloCreations
Scratcher
500+ posts

API link to follow someone?

ev3coolexit987654 wrote:

It has to be a POST request not a GET request
how exactly do i do that?
EncloCreations
Scratcher
500+ posts

API link to follow someone?

Is it this possibly?
$.ajax({
type: “POST”,
url: "https://scratch.mit.edu/site-api/comments/user/“ + anyuser + ”/add/",
});

Last edited by EncloCreations (Dec. 24, 2015 16:20:19)

Dylan5797
Scratcher
1000+ posts

API link to follow someone?

EncloCreations wrote:

Is it this possibly?
$.ajax({
type: “POST”,
url: "https://scratch.mit.edu/site-api/comments/user/“ + anyuser + ”/add/",
});
Nononono it's PUT not POST
EncloTester
Scratcher
15 posts

API link to follow someone?

Dylan5797 wrote:

EncloCreations wrote:

Is it this possibly?
$.ajax({
type: “POST”,
url: "https://scratch.mit.edu/site-api/comments/user/“ + anyuser + ”/add/",
});
Nononono it's PUT not POST

This is what i came up with, im basically editing Icelys script so that it follows instead of commenting, but i keep getting a bunch of errors
var username = Scratch.INIT_DATA.LOGGED_IN_USER.model.username;

user = prompt(“Insert your username”);

if (username== user ){
username = prompt(“Please enter your username.”);
}

var numofpages = prompt(“How many pages of followers does this user have?”);
var myFollowers = ;
var page = 1;

function start( e ) {
$.get( "https://scratch.mit.edu/users/“ + username + ”/followers/?page=1", loaded );
}
function loaded( data ) {
var $dom = $( data );
var $users = $dom.find('span.title').children();

for (var i=0; i<$users.length; i++) {
var user = $users.text.trim();
myFollowers.push(user);
}
console.log(“Done page” + page);
page++;

if(page < numofpages){

$.get( "https://scratch.mit.edu/users/“ + username + ”/followers/?page=“+page, loaded );
}
else{
postmethod();
}
};

function postmethod(){

var start = confirm(”Start?“);
console.log(myFollowers);
if(start == true){
for (var i = 0; i<myFollowers.length; i++){
console.log(”Running…");
var current = myFollowers;
$.ajax({
type: “PUT”,
url: "https://scratch.mit.edu/site-api/user/followers/“ + current + ”/add/“,

});
console.log(”Sent to user “ + current);
}
console.log(”Done.“);
}
else {
console.log(”Canceled.“);
}
};

console.log(”Stating…");
start();

Last edited by EncloTester (Dec. 24, 2015 17:15:21)

EncloTester
Scratcher
15 posts

API link to follow someone?

Here is what the console reads


Stating…
VM167:1 Done page1
VM167:1 Array
VM167:1 Running…
VM167:1 Sent to user Ep1cFollower
VM167:1 Running…
VM167:1 Sent to user mineguy1004
VM167:1 Running…
VM167:1 Sent to user Episode2
VM167:1 Running…
VM167:1 Sent to user Robo-Cube
VM167:1 Running…
VM167:1 Sent to user Coder11000
VM167:1 Running…
VM167:1 Sent to user awserglsah
VM167:1 Running…
VM167:1 Sent to user daddyhulk
VM167:1 Running…
VM167:1 Sent to user meowmoo
VM167:1 Running…
VM167:1 Sent to user EncloCreations
VM167:1 Done.
https://scratch.mit.edu/site-api/followers/user/mineguy1004/add/ Failed to load resource: the server responded with a status of 404 (NOT FOUND)
base.js:8 Uncaught Uncaught ajax error. Attempted URL: https://scratch.mit.edu/site-api/followers/user/mineguy1004/add/ Status: 404
https://scratch.mit.edu/site-api/followers/user/Ep1cFollower/add/ Failed to load resource: the server responded with a status of 404 (NOT FOUND)
base.js:8 Uncaught Uncaught ajax error. Attempted URL: https://scratch.mit.edu/site-api/followers/user/Ep1cFollower/add/ Status: 404
https://scratch.mit.edu/site-api/followers/user/Episode2/add/ Failed to load resource: the server responded with a status of 404 (NOT FOUND)
base.js:8 Uncaught Uncaught ajax error. Attempted URL: https://scratch.mit.edu/site-api/followers/user/Episode2/add/ Status: 404
https://scratch.mit.edu/site-api/followers/user/Robo-Cube/add/ Failed to load resource: the server responded with a status of 404 (NOT FOUND)
base.js:8 Uncaught Uncaught ajax error. Attempted URL: https://scratch.mit.edu/site-api/followers/user/Robo-Cube/add/ Status: 404
https://scratch.mit.edu/site-api/followers/user/Coder11000/add/ Failed to load resource: the server responded with a status of 404 (NOT FOUND)
base.js:8 Uncaught Uncaught ajax error. Attempted URL: https://scratch.mit.edu/site-api/followers/user/Coder11000/add/ Status: 404
https://scratch.mit.edu/site-api/followers/user/awserglsah/add/ Failed to load resource: the server responded with a status of 404 (NOT FOUND)
base.js:8 Uncaught Uncaught ajax error. Attempted URL: https://scratch.mit.edu/site-api/followers/user/awserglsah/add/ Status: 404
https://scratch.mit.edu/site-api/followers/user/meowmoo/add/ Failed to load resource: the server responded with a status of 404 (NOT FOUND)
base.js:8 Uncaught Uncaught ajax error. Attempted URL: https://scratch.mit.edu/site-api/followers/user/meowmoo/add/ Status: 404
https://scratch.mit.edu/site-api/followers/user/EncloCreations/add/ Failed to load resource: the server responded with a status of 404 (NOT FOUND)
base.js:8 Uncaught Uncaught ajax error. Attempted URL: https://scratch.mit.edu/site-api/followers/user/EncloCreations/add/ Status: 404
https://scratch.mit.edu/site-api/followers/user/daddyhulk/add/ Failed to load resource: the server responded with a status of 404 (NOT FOUND)
base.js:8 Uncaught Uncaught ajax error. Attempted URL: https://scratch.mit.edu/site-api/followers/user/daddyhulk/add/ Status: 404
Navigated to https://scratch.mit.edu/users/EncloTester/
Navigated to https://scratch.mit.edu/search/google_results/?q=xerio&date=anytime&sort_by=datetime_shared

Last edited by EncloTester (Dec. 24, 2015 17:16:18)

EncloTester
Scratcher
15 posts

API link to follow someone?

I get the same error with “PUT” or “POST”
Dylan5797
Scratcher
1000+ posts

API link to follow someone?

EncloTester wrote:

I get the same error with “PUT” or “POST”
On mobile. Help in morning
Happy holidays
MonkeyBean2
Scratcher
500+ posts

API link to follow someone?

BUMP!!!!!!!!!!!!!!
kccuber
Scratcher
1000+ posts

API link to follow someone?

MonkeyBean2 wrote:

BUMP!!!!!!!!!!!!!!

mybearworld wrote:

https://scratch.mit.edu/site-api/users/followers/ToBeFollowed/add/?usernames=Follower
Please don't necropost.

Powered by DjangoBB