|
|
@ -4,7 +4,26 @@ const requestsync = require('sync-request'), |
|
|
|
|
|
|
|
try { |
|
|
|
let actors, |
|
|
|
followed = [] |
|
|
|
followed = [], |
|
|
|
count = 100 |
|
|
|
do { |
|
|
|
let id = actors && actors.length > 0 ? actors[actors.length - 1].id : '', |
|
|
|
body = requestsync('GET', url + '/api/v1/accounts/9lM7CeFGQNLWp38fgW/following?max_id=' + id + '&limit=' + count) |
|
|
|
try { |
|
|
|
actors = JSON.parse(body.getBody()) |
|
|
|
if (actors && actors.length > 0) { |
|
|
|
for (let a of actors) { |
|
|
|
if (a && a.id && !followed.some(f => f === a.id)) { |
|
|
|
followed.push(a.id) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
console.log(e) |
|
|
|
} |
|
|
|
console.log('Loading users: ' + followed.length) |
|
|
|
} while (actors && actors.length >= count) |
|
|
|
actors = [] |
|
|
|
do { |
|
|
|
let id = actors && actors.length > 0 ? actors[actors.length - 1].id : '', |
|
|
|
body = requestsync('GET', url + '/api/statuses/networkpublic_timeline?max_id=' + id + '&only_media=false&count=20&with_muted=true') |
|
|
@ -17,17 +36,17 @@ try { |
|
|
|
if (a.in_reply_to_user_id && !followed.some(f => f === a.in_reply_to_user_id)) { |
|
|
|
requestsync('POST', url + '/api/v1/accounts/' + a.in_reply_to_user_id + '/follow') |
|
|
|
followed.push(a.in_reply_to_user_id) |
|
|
|
console.log('followed: ' + a.in_reply_to_user_id) |
|
|
|
console.log('Following: ' + a.in_reply_to_user_id) |
|
|
|
} |
|
|
|
followed.push(a.user.id) |
|
|
|
console.log('followed: ' + a.user.screen_name) |
|
|
|
console.log('Following: ' + a.user.screen_name) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
console.log(e) |
|
|
|
} |
|
|
|
console.log(url) |
|
|
|
console.log('Following: ' + followed.length + ' accounts') |
|
|
|
} while (actors && actors.length >= 20) |
|
|
|
} catch (e) { |
|
|
|
console.log(e) |
|
|
|